這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

WP Ajax Query

外掛說明

WP Ajax Query allows you to query your WordPress database using the same query paramaters you would use for WP_Query, and return a JSON respresentation of the query results. This allows developers to easily interface with WordPress without having to relearn a new API.

How It Works

The Ajax Query interface would be available at http://example.com/wp-admin/admin-ajax.php?action=query

A sample jQuery request would be like:
$.get(ajaxurl, { action: ‘query’ }, function () { }, ‘json’);

Querying for a post:
$.get(ajaxurl, { action: ‘query’, p: 1 }, function () { }, ‘json’);

JSON results:
{
“id”: 1,
“type”: ‘post’,
“title”: “Hello World”,
“permalink”: “http:\/\/example.com\/?p=1”
}

Query a category:
$.get(ajaxurl, { action: ‘query’, cat: 1 }, function () { }, ‘json’);

JSON results:
{
“id”: 1
“type”: “category”,
“permalink”: “http:\/\/example.com\/?cat=1”,
“terms”: [],
“posts”: []
}

terms and `posts` represents an array of either terms that are sub categories of the category, or posts belonging to the category.<h3>Why I Created It</h3>

Needed a common way to query the database for posts and taxonomies across multiple plugins, and didn’t find a suitable replacement.

安裝方式

  1. Upload the wp-ajax-query folder into your plugin directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈WP Ajax Query〉的開發相關工作。

參與者

將〈WP Ajax Query〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄