A piece of javascript/jquery:
$("#queryMenu ul li a").click(function(){
var currentCategory = $(this).attr('id');
$.ajax({
type: 'post',
url: 'ajax-category.php', //sometimes I'm using bloginfo to get current path: url: '<?php bloginfo('template_url'); ?>/ajax.php',
data: {
currentCategory: currentCategory
},
success: function(data) {
console.log(data);
}
});
});
Put right path in url. Use $_REQUEST['currentCategory']
inside ajax-category.php to get category ID…
Related Posts:
- Pagination for ajax category filter
- Exclude posts without category from loop
- Remove “?category=” in the URL wordpress ajax filter work for category
- Get the children of the parent category
- How to check if I’m on the last page of posts?
- How do I get the category URL from get_the_category?
- Default WP Gallery – show only galleries of a certain category
- ajax category filter
- Display all posts in category, with specific tag posts at top
- Load categories with ajax
- Loop with Dynamic Categories
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- How to exclude categories from recent posts, recent comments & category widgets?
- Listing all posts from current category on page
- Filtering by Category doesnt paginate correctly on the backend
- Dropdown category filter
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Hide posts of a certain category unless logged in
- Why would in_category only return one post in a specific category?
- Automatically set default password to all posts in a specific category
- get_the_categories filter returns an empty array
- Class active for Archive link – looped out
- Taxonomy name repeating when showing 2 posts from each category
- Filter Categories in meta box for CPTs
- Display the last post by each category?
- Show only first category name in RSS?
- Counter in loop in foreach
- Filter $cpt categories to omit certain category
- How to set a filter by category within a customised page
- Multiple Loops on category.php with pagination on last loop
- How to exclude the last post from a category(featured for example) from the main loop?
- Admin comments and user restrictions
- Order by category titles
- WordPress Post # of # filtered by category slug
- How to hide category name
- How to insert category list into post creation page, and retrieve chosen categories?
- Limit get_categories to show each category once
- Display single category name in woocommerce loop
- Show Posts from Single Category Not Working
- How to make the ‘delete’ button inactive on some categories?
- Is there a reason I cannot get the current category in a loop?
- Pagination on category.php and tag.php not working
- new WP_Query all post in a category inside the loop
- Problem with different query loops (and “main loop”) on category template page!
- How to do paging in the loop?
- How to add orderby parameter for sorting on category.php
- How to loop custom post_type from (a) specific category(ies)?
- Display all product tags associated with a specific product category
- Category tags with comma’s
- Display posts of certain categories to specific user roles
- Filter posts by categories ajax is showing nothing
- Change post title if post has specific category
- Filter By Category Dropdown List With Custom Taxonomies
- Category nicename inside loop in wordpress
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- multiple values in an array for category__and does not work with WP_Query
- List post only under the category, exclude child category content
- Editing Loop So It Targets Specific Tags?
- Change Default Content when Creating a Post based on Previous Category Choice
- Maintaining a separate posts page for certain categories and don’t show those on home page
- How to get posts using category slug in ClassiPress?
- Get current taxonomy and display query accordingly
- Posts made to category don’t show up (do show up on frontpage)
- How to filter post from categories only if the posts appears in one of them, not the other?
- Display all categories but only if they have posts in them that have a specific tag assigned
- How to fix select filter on category
- wp_dropdown_categories() works correctly but the list is not filtered in admin for custom post type. What is the problem?
- Add $args to wp_list_categories
- How to hide a category or tag everywhere EXCEPT for use with get_posts
- how to filter posts by category without page load (ajax) in wordpress?
- Restrict retrieved terms by category?
- WordPress Ajax filter: Create two loops for different output styles?
- Please tell how to stop the category from showing up on posts
- Ajax load more not working with multipler categories
- Loop by category and meta_key
- Ajax Category add doesn’t update the list table custom column
- Hiding by default posts in given category except for some cases
- Assign a class to first element in category in loop
- Category page shows only 1 post when that post has more than 1 category?
- Configure query with multiple categories in a custom order?
- How can I modify this code to iterate over an array of categories?
- Custom filters inside a specific category?
- How to exclude a specific categogy from a custom page template
- Display one post on category.php: Wrong featured image
- filter single_cat_title avoiding the breadcrumbs
- WordPress Numeric Pagination with Query String [duplicate]
- Printing direct descendants of a category with WP_Query
- Ajax call activate after submit in edit-tags.php page
- My Query is getting the wrong data
- Bringing Ajax Loading Feature on Category Pages
- How do i add custom post types to this query?
- Custom WordPress category page showing all posts rather than the specified category
- How do I hide posts in a category from all listings but still allow the posts to be viewed?
- Display post content from category name using ajax
- Do not show all post from all categories, just show posts from category in current loop
- Echo Category In Loop