php - How can I filter / query wordpress posts using ajax, live? -
i have wordpress website, has number of posts, , number of filters (with ui set up) in theme custom build.
want want change query posts tags live using ajax, user can posts want using filters:
- popularity (custom taxonomy)
- time posted
- tags
- colour (custom),
- keyword (using search bar)
- category
i have found php script similar thing, not live, , not give ability update live; script here query.
<?php if( !empty($_get['order']) ) $order=$_get['order']; else $order='desc'; // default if( !empty($_get['orderby']) ) $orderby=$_get['orderby']; else $orderby = 'date'; // default if( !empty($_get['cat']) ) $orderby=$_get['cat']; else $category = ''; // default query_posts('orderby='.$orderby.'&order='.$order.'&meta_key='.'_post_like_count'.'&cat='.$category) ?>
the script changing (that changes queries) here, anchor adds url onto the search term.
<a href="?order=desc&orderby=meta_value_num">popular</a>
i have done querying few values, before whole filtering system working, , acknowledge may have re done, know ajax cannot change url live user, , has use requests.
does know how approach task in way, , can give me guidance on how achieve it?
i open plugins, yet prefer integrating locally custom theme build.
Comments
Post a Comment