- This topic is empty.
-
AuthorPosts
-
February 26, 2011 at 4:58 pm #31794
dkanderson
MemberHi guys I am, new here and I need help. I am trying to filter some content in wordpress based on a dropdown menu. Right now my query loads a list of post of a custom post type. like so:
if (have_posts()) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( 'posts_per_page=24&paged='.$paged.'&post_type=discount_partners' );
}
?>
ID, 'discount', true); ?>
ID, 'tel', true); ?>
That works great and the results are paged with wp-pagenavi. What I have be struggling with is a way to further filter this from a dropdown list based on a particular category within the custom post type: “discount_partners”;
my approach thus far was to use jquery.post() function and use a php file with just the modified loop but it somehow doesn’t recognize the wordpress functions at all when jquery calls it like so:
$("#filter_partners").click(function(){
var selectedCategory = $("#select_category").val();
var selectedParish = $("#select_parish").val();
$("#qresults").hide('slow');
$.post("/select_results.php", {queryParish: ""+selectedParish+"", queryCategory: ""+selectedCategory+""}, function(data) { // Do an AJAX call
$('#show_results').fadeIn(); // Show the results
$('#show_results').html(data); // Fill the results box with new filtered query
});
return false;
});
I hope I have explained enough so my dilemma is understood. I think my problem is I am taking the wrong approach, but I am fairly new to jquery and just trying to piece ideas together i will take any help any suggestions at this point I will continue to tinker and hope. Stata Buon.
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.