How does Wordpress build an API environment?

Source: Internet
Author: User
We want to use WP as the background to create a Hybird application. I have never done HybirdApp before. I want to use JqueryMobile + Phonegap or Appcan to complete the installation of a plug-in named JSONAPI, which can indeed export JSON data, but it seems that there are still some problems, for example, there is no complicated TagsPost... we want to use WP as the background to create a Hybird application. I have never done HybirdApp and want to use JqueryMobile + Phonegap or Appcan

I just installed a plug-in named json api, which can indeed export JSON data, but it seems that there are still some problems. For example, there is no data in the complicated Tags Post. After I found that it was WP4.0, JSON support has been added, and many plug-ins and articles about Wordpress JSON are found to be confusing.

Is there any correct way to build a Wordpress JSON api?

Reply content:

We want to use WP as the background to create a Hybird application. I have never done HybirdApp and want to use JqueryMobile + Phonegap or Appcan

I just installed a plug-in named json api, which can indeed export JSON data, but it seems that there are still some problems. For example, there is no data in the complicated Tags Post. After I found that it was WP4.0, JSON support has been added, and many plug-ins and articles about Wordpress JSON are found to be confusing.

Is there any correct way to build a Wordpress JSON api?

I feel that the subject is circled. For details, refer toDescribe the target, not the process
Https://github.com/seajs/seajs/issues/545

Based on the existing objectives, I can't understand why WP is used. I want to return JSON data (and support the WP environment) directly to the PHP script.

Use echo json_encode (data ).

Update by subject comment:

Thank you for your answers. I mainly want to describe the problems I have encountered. In fact, I want to ask how to do the best. In addition, I want to use WP to call it based on the information on my current website ~

Since WP is used for calling Based on WP station information, the idea is clearer:

  1. How to export WP site information (based on JSON)
  2. How to use this information in the Hybrid APP

The current problem description does not involve the Hybrid APP.

Search by Google for fan qiangWordpress json api

The first result is: https://wordpress.org/plugins/json-api/

There are complete json api installation and use tutorials,

1.3. Responses
The standard response format for json api is (as you may have guessed) JSON.

Here is an example response from http: // localhost/wordpress /? Json = 1 called on a default WordPress installation (formatted for readability ):

{  "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": "

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": "

Hi, this is a comment.
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" } ]}

From the returned data, there are tags and post, which can meet the requirements of the subject.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.