ຄຳອະທິບາຍ
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.
ການຕິດຕັ້ງ
- Upload the
wp-ajax-queryfolder into your plugin directory. - Activate the plugin through the ‘Plugins’ menu in WordPress
ການຣີວິວ
ບໍ່ມີການຣີວິວສຳລັບປລັກອິນນີ້.
ຜູ້ຮ່ວມພັດທະນາ ແລະ ຜູ້ພັດທະນາ
“WP Ajax Query” ແມ່ນຊອຟແວໂອເພັນຊອດ (Open Source). ບຸກຄົນຕໍ່ໄປນີ້ໄດ້ມີສ່ວນຮ່ວມໃນການພັດທະນາປລັກອິນນີ້.
ຜູ້ຮ່ວມພັດທະນາແປ “WP Ajax Query” ເປັນພາສາຂອງເຈົ້າ.
ສົນໃຈຮ່ວມພັດທະນາບໍ່?
ເບິ່ງລະຫັດ, ກວດເບິ່ງ ຄັງເກັບ SVN, ຫຼື ຕິດຕາມ ບັນທຶກການພັດທະນາ ຜ່ານ RSS.