assign the additional category ‘featured’ to the post in the category ‘medical’.
in your category template, use a query with 'category__and' => array(3, 27)
example (assuming ‘medical’ is cat 3, and ‘featured’ is cat 27):
<?php $args = array(
'category__and' => array(3, 27),
'posts_per_page' => 1
);
$feature = new WP_Query( $args );
if( $feature->have_posts() ) : while( $feature->have_posts() ) : $feature->the_post(); ?>
<div class="featured">
ANY POST OUTPUT <?php the_title(); ?>
</div>
<?php endwhile; endif; ?>
Related Posts:
- How to show related posts by category
- Display all posts from specific categories on a page
- Query only Posts from Both of Two Category?
- Category Foreach keeps looping?
- How to make multiple sections in home pulling posts category wise?
- All categories displays the same posts
- WordPress displays post on subcategory only
- How to get posts ordered by using their categories?
- Getting posts from some categories plus some individual posts
- How to display particular categorie’s post which associated to specific user?
- Querying posts from current category, using a variable as array argument
- Need help writing loop to display posts by categories in separate divs
- Query post category & remove any post id
- How to pass multiple checkbox values to wordpress query?
- Change from all posts to specific categories post on main page?
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to show all posts of the category in wordpress?
- Manipulate post category after time
- Categories box not showing on post edit pages
- List only child categories a post is in, of a specific parent category
- Add custom field to all posts in specific category
- Can’t show comments count per post outside loop
- is there a better way of combining this?
- wp_list_categories link to first post of category instead of calling taxonomy template
- Display posts in alphabetical order for a particular category
- How to make search for the custom post type?
- Improving WP_Query for performance when random posts are ordered
- How to automatically apply a category based on the post title?
- Direct link to “New post” in specific category?
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Using permalinks, category slugs, and tag slugs
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- How do I retrieve then print the currently viewed sub categories?
- Get user categories with most posts in it
- Get attachments for posts that belongs to a specific category
- How can I setup a relationship using categories in WordPress?
- Related posts by category not working right
- Listing Specific Categories from Current Post with Depth
- How to display two blog categories as separate sections on one page?
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- get_the_category listing in hierarchial order
- Nested WP_Query breaking loop
- query_post order desc
- Query for first 3 posts to change the look and feel
- get posts from Custom Post Type & Category
- Shortcode with ‘year’ parameter
- Show posts on front page only
- WordPress query portfolio posts
- Post is in descendant category not working in home.php
- Hide parts of the post content after typing it’s name or searching it by category
- SQL Bulk Move old posts by one author to another category
- load more posts by category
- Display Related Posts by Category in Random
- Display 3 posts with different HTML markup using a loop
- How to show beneath posts the full category path?
- How to assign a post to a post parrent?
- get parent fields title, content excerpt etc
- Display Current Posts Category (with the most posts)?
- AWS usage queries
- Only the most recent post is showing on my category page (working on localhost, not live site)
- How display related post only in Default category on single
- How to merge the content of posts that have the same title?
- ACF date picker to trigger category change
- Get category slug of the Parent category of a Product
- How to fetch courses in all languages in WordPress?
- exclude particular category in api
- Posts are not displaying on their category and tag page
- Make categories appear random
- How can I use query_posts to loop through posts and construct my own content?
- How to make a page show posts only from specific categories without editing php files
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Get posts from category from custom query
- Show 5 posts and than 3 posts offset with pagination
- Post Category link is same with Page link
- How to show posts ordered by random [duplicate]
- How to Get Position of a Post from a category and tag
- Display new posts categories in separated divs
- Add Categories To Custom Post
- Query posts from newest category
- Display Posts by Categories
- Ajax – Post Categories and Load More
- Edit Posts Page but not category specific pages?
- Modify WordPress loop after it has been run
- Ordering posts alphabetically by meta keys and title
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Remove duplicated posts in the loop if post has more than one category
- How to organise post by category and date
- Show post if in category
- How to display custom content in post with category XXX
- Displaying categories items among posts
- Displaying different posts Via wp_list_categories()
- Is possible to create a custom link that creates a post that’s already categorized?
- single.php fires more than once after clicking on any post to view with different post id each time
- How to display subcategory articles in the category view?
- Display ONLY Latest Post From Several Categories
- Show all posts in category
- Polylang – display one post into 3 categories with different lang [closed]
- Export Posts Without Categories In An XML File
- Site ‘Categories’: save an admin global setting with post metadata [closed]