That’s because that’s what you’re asking for:
'category__in' => array($category),
It’s only going to show posts in that category.
You shouldn’t be using get_posts()
or WP_Query()
in category.php
. WordPress has already queried the correct posts. You should only be using the standard loop to display them:
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
// Display post content
endwhile;
endif;
?>
Related Posts:
- How do I change the gallery that is inserted in the post?
- New blog template to display only one category
- Convert a complex webpage into WP theme
- Mark menu item as current-menu-item for category
- Why orderby=”date” does not support manually changed posts?
- How to show single post page as home page
- Exclude category from
- Blog page not working
- Disable sticky option for specific categories
- Highlight static blog page link in header
- Block editors annoying warnings
- how to hide empty fields of post category description?
- Give posts a particular template based on the assigned category
- Change the background of each post according to the category
- How do I allow certain users to make a certain type of post?
- Display a specific category in a focused area of my site
- Latest Posts not in the right order
- wordpress taxonomy results
- Change from all posts to specific categories post on main page?
- Get posts after calculating meta key
- Is there a block to print post link standalone in a block theme?
- Show category name in category.php when posts assigned to multiple categories
- Including categories in search results
- Count how many posts in category
- Custom Single Post By Category
- Convert custom fields to post categories
- Query posts from current year
- how to display full post with pagination on home page
- Show One Category on Post
- Do I use custom post type or something else?
- What Defines What Category A Post Picks (if in multiple)
- Limit function to specific post category
- Show all post titles
- Add Category name to Post Title (h1)
- Posts are not showing up on particular category
- How to display related posts by subcategory and not parent category
- Category Template: Need to display different content on first page of archives
- Display post category in foreach loop with category link
- Extracting post categories
- How to limit posts by category
- How to use format post in a pertinent way
- Get user categories with most posts in it
- How to change the color theme per post?
- How to list recent posts in a wp nav menu?
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- How to display two blog categories as separate sections on one page?
- How to create a template for Pages?
- How do I do a page break?
- why does wordpress ignore the post args?
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- get posts from Custom Post Type & Category
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- Sort by last word in title
- How to call posts under a specific category on static front page?
- Extract wordpress posts content and category content
- Post-Archive like a page in a specific subdirectory
- How to display only one category in a custom post type?
- Get only X number of categories
- inserting a category into post
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- latest post showing up twice on posts page
- wp_list_categories() Exclude All Categories Except One
- Am getting duplicate data from get_posts()
- Different post views for different category views
- Possible?! A contextually titled back link
- Allow / show post comments in category pages
- How to select a category automatically based on a word in WordPress post title?
- Display default matabox of posts(add category) wordpress
- How display related post only in Default category on single
- How to get tags when using publish_post
- How to add class to specific navbar item when post parent category is in specific category
- Include Recent Post in Category
- How do you change the permalink for posts for a single category?
- Posts are not displaying on their category and tag page
- how to create a category with wp_insert_post and post_category
- Exclude posts in a category on one page but show those posts on a different page
- How to add a block to a category page?
- Excluding category from post navigation in WordPress?
- Post Category link is same with Page link
- Show custom post category for single post
- Get a list of categories that are related to posts
- Querying posts from current category, using a variable as array argument
- Display post order ranking within wordpress loop
- Precedence of page permalinks over woocommerce product category links?
- Need help writing loop to display posts by categories in separate divs
- Add category selection to function request
- Query post category & remove any post id
- Multiple Post Repeat for Related Post Loop by Category
- Show Post number of specific Category
- WP Load post with ajax and apply isotope
- Display the current post author and his url in the post header
- how to show posts on different pages if number of post per page is one
- Is possible to create a custom link that creates a post that’s already categorized?
- Is it possible to have different header style blog titles in different categories?
- Category pages vs single post pages
- How to display subcategory articles in the category view?
- How do we display a certain category type on a page while hiding all others?
- Convert HTML5 to WordPress theme
- Hindi content automatically converting to unreadable language?