This looks wrong:
if ($query->have_posts()) { $count = 0;
while ($query->have_posts()) { the_post(); $count++;
Use this:
if ($query->have_posts()) { $count = 0;
while ($query->have_posts()) { $query->the_post(); $count++;
Related Posts:
- 404 Error On Category and Tags Pages
- How to get category and archive title?
- Category archive by year with permalink support /category/YYYY
- get_categories for custom post type with a specific custom taxonomy attached
- How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
- Force WordPress to Show Pages Instead of Category
- Decreasing the Memory Consumption of a WordPress Site?
- What’s the URL for a category archive?
- Sort posts by tags in category pages
- How to get the category of the post and link it to the archive (of the category)
- How to hide a specific category posts in my monthly archive?
- Display posts links from a category group by year
- Display list of Sub-Categories and the posts they contain, within one main Category
- Sort category page with custom field
- How to create tabled index of posts in a certain category
- Root level category, tag, author and archive pages to work
- Category Specific Archive
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- “Sticky” posts for each category (archive.php)
- How to filter archives both by category and tag?
- Remove Archive Headline and Archive Intro Text fields on category and tag archive pages in WordPress Admin with Genesis framework
- Display only posts from referred category on date archive page
- Using widget logic I want to show only a widget on the archive page if there are no posts
- Creating archive pages for children categories
- Display “add to cart” button on every listing in product category page?
- If newest post of category is newest post in general, skip first post of category
- WordPress categories being called “archives” in google links. How to remove?
- conditional for sub category on archive page
- WP_Query() returns null when results exist!
- How to remove category titles?
- Show archives by year from just one category
- WordPress Genesis not excluding category from blog
- Archives for each category on WP Multisite
- Archive.php filtered by pre-determined category
- How do I call posts with a certain tag?
- Category being displayed without base parmalink
- How can I define a custom archive for childs of a specific category?
- Restoring default article pagination on archives – Removing custom limits
- Category archive rewrite rule to include category/subcategory?
- add_rewrite_endpoint returns 404 on archives
- Multiple category archive page
- Category archives with monthly pagination
- Putting a Category of posts under a Page
- Woo Framework: woo_cat_featured not populating
- how to “not” display new posts with a specific category on the main page?
- How to Remove a Title from All Category and Tags Page?
- Functions.php: Exclude Category from “Blog”
- How can I display tags as categories?
- Do not show sub categories in the loop on archive-product.php
- About title on a page
- display category list year wise in wordpress
- Display subcategories in dropdown
- How to display post in custom file not in archive file?
- Hide a category of posts from main blog, and only show in category view
- WordPress showing wrong category name
- Add code to header based on category for specific posts?
- Media (images, videos, etc.) not showing on Category page
- WordPress monthly archive category specific
- Problem with multiple loops in wordpress theme
- Displaying year once in category.php [duplicate]
- Restrict CSS on one page
- what file I need to create to work date archive links?
- Archive filtering
- Show Secondary Sidebar on Category pages (archive)
- Displaying a custom field in Category Archives
- Add multiple orderby with pre get posts
- Redirect Problems with Archive Page and GET variables
- excude a specidic category from showing in the “relative posts”
- Category post count is not correct
- List of post categories only associated to another custom taxonomy
- How to create category filter on a blog like on the site below?
- Is it possible to set up blog categories without changing permalink structure
- Show the parent taxonomy by creating shortcode in woocommerce?
- How Can I Display the Category Description in a Theme with no Category.php or Archive.php?
- Display Category yearly wise in wp
- How to add excerpt and read more button to category archive page
- Display all posts from specific category
- Get posts from category from custom query
- Custom Category Archive Pages
- custom browse by
- How to get get_categories()’s ‘hide_empty’ argument to work with global year var in the archive template?
- get_the_terms_list output last child only
- How to get related category/categories in WordPress archive page
- Category archives
- List post categories that link to a page showing those posts
- Create monthly archive for parent category
- How to count the number of monthly archive?
- Conditional statements based on custom meta value in category archives
- date.php shows all posts. how to fix it?
- Pages, Categories, and working with someone else’s code
- 2 loops in archive.php (one for each category)
- Archives and category of authors
- Multiple Categories under one URL, where ‘Front Page’ is used already
- Category Archives: Show posts categorized in parent category only
- All post of child category not in top category
- How to show monthly archive posts?
- how to implement next/prev within category archive?
- How to link ACF relationship field to the new Query block in Full Site Editing
- Sorting past events by month
- Sort Category Archive pages and place sticky posts first