简体   繁体   中英

How to filter list of custom post type with 2 custom taxonomy with ajax in wordpress

i've a custom post type that i called it app with 2 custom taxonomy that i called them app_platform and app_category

and now in taxonomy-app_platform.php page i wanna show whole of apps with specifed app platform along with a drop-down list that shows list of app_category like this .

在此处输入图片说明

so in the end . i able to filer list app with specifed app_platform and app_category

Note That: in the first time that page is loaded i just wanna show whole of apps in specifed app platform . for exmaple whole of android application

how can i do it with ajax and good performance?

Since this is a wordpress issue (I believe) you are likely using MySQL to store your data which means you can't use CTEs. What you will have to do is something like this:

In $(document).ready return your result set in JSON write a query something like this:

"SELECT DISTINCT FROM table where AppCategory = 'iPhone 7` LIMIT 0, 50"

This would return 50 records of that category.

Inside the AJAX call you would then populate the select list based on these results.

I will need more info to take you any further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM