Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5948687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:08:36+00:00 2026-05-22T17:08:36+00:00

I enabled json API successfully in a WordPress blog but I have hard time

  • 0

I enabled json API successfully in a WordPress blog but I have hard time returning data with jQuery.

http://example.com/?json=1&count=1&include=title

Here is the json format. Ideally I’d like to append in a div called #homeblog, the last post title, linked to the post itself.

{
  "status": "ok",
  "count": 1,
  "count_total": 1,
  "pages": 1,
  "posts": [
    {
      "id": 1,
      "type": "post",
      "slug": "hello-world",
      "url": "http:\/\/localhost\/wordpress\/?p=1",
      "title": "Hello world!",
      "title_plain": "Hello world!",
      "content": "<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!<\/p>\n",
      "excerpt": "Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!\n",
      "date": "2009-11-11 12:50:19",
      "modified": "2009-11-11 12:50:19",
      "categories": [],
      "tags": [],
      "author": {
        "id": 1,
        "slug": "admin",
        "name": "admin",
        "first_name": "",
        "last_name": "",
        "nickname": "",
        "url": "",
        "description": ""
      },
      "comments": [
        {
          "id": 1,
          "name": "Mr WordPress",
          "url": "http:\/\/wordpress.org\/",
          "date": "2009-11-11 12:50:19",
          "content": "<p>Hi, this is a comment.<br \/>To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.<\/p>\n",
          "parent": 0
        }
      ],
      "comment_count": 1,
      "comment_status": "open"
    }
  ]
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:08:37+00:00Added an answer on May 22, 2026 at 5:08 pm

    If you want to append some data returned by the JSON api to a page you would need something like:

    $(document).ready(function(){
        $.getJSON("http://example.com/?json=1&count=1",function(data) {
            $('body').append('<a href="'+data.posts[0].url+'"><div id="homeblog">'+data.posts[0].title+'</div></a>');
        }
    

    I have removed the include=title part of the json call because that excludes everything else. You are using getJSON to return the post data, then it is just a case of constructing your html and append ing it to the page somewhere (in my case right onto the <body> tag)

    EDIT: there is a wordpress stackexchange for wordpress questions. you will have more luck asking questions like this over there.

    (added a right bracket)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, I'm using a JSON-enabled Rails web-service to provide data to an iPhone application.
I need to make a request to an API which returns json formatted data.
I am managing a RESTful JSON data API, which is growing in scope. Currently,
In JQuery Datatables plugin, how do we attach JSON to a Datatable-enabled table when
My RMI enabled application seems to be leaking sockets. I have a Java application
Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this
I have extended regexes enabled in my Bash by shopt -s extglob They may
I have enabled the Web Server on my Mac OS X (10.5.6) by going
I'm trying to load a jqGrid from json data made via a REST call.
I'm trying to setup a CORS enabled API that I can access via JavaScript.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.