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 related posts by detecting the current category?
- Display posts on a custom page from only a specific category?
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- how to hide empty fields of post category description?
- how can i display my posts alphabetically?
- Post Filtering by GET URL parameters
- if in category but only with post meta
- How to get post with associated categories and tags names instead of ids with rest api?
- On what hook can I get the queried object’s final state?
- Display a mixed list of posts and media
- Migrate posts from category and sub-category via SQL
- Parent category / child category posts
- Posts Missing in Dashboard after update
- wp_query with ajax
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- How to give classname to post if post has no content?
- Sort by last word in title
- Display post number by category
- Get the most recently modified post date of most recently modified post
- WP_Query: Show 10 posts in date order, first three random
- singular posts using archive styling
- Custom posts listing widget always returns 1 extra result
- Change Post Title For Specific Category
- Get post by tag
- Display selected categories onto post page
- How to call posts under a specific category on static front page?
- Random posts that always include a particular post?
- WordPress post filter menu
- Give posts a particular template based on the assigned category
- How to have more than one page for your posts if you have 8 posts but can store max 4 on a page
- Extract wordpress posts content and category content
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Bootsrap carousel for post
- How to get post with slug and exclude categories
- Having pages after specifying post_type post
- Unable to differentiate between two categories under custom post type on single.php
- In what context should Categories and Tags be used
- Exclude post category in a blog page
- Show posts on front page only
- list posts from two categories on a page – plugin not working
- Retrieving posts by their date and category
- Get latest post from categories
- How to create a playlist for audio associated with posts per category
- Get postlist for each category using query_posts?
- How to save posts position on homepage after random function?
- Are post, page and category IDs unique to each other?
- Query function not executed between element [closed]
- Echo the number of posts being displayed
- Change the background of each post according to the category
- Exclude a category of posts in author template
- Static pages not working
- WordPress query portfolio posts
- Post-Archive like a page in a specific subdirectory
- Programmatically add posts from specific category to menu
- Display specific posts on home page
- WP_Query of Category Not Showing First Post
- Post is in descendant category not working in home.php
- Remove Featured Image from posts in specific category?
- How to show a featured image inside a post in only 1 single category
- WP_Query articles order by offset in collumns
- 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
- How to display only one category in a custom post type?
- load more posts by category
- Get post category as a separate string and url
- Get only X number of categories
- Display Related Posts by Category in Random
- inserting a category into post
- Trying to query all posts in category 4
- Display 3 posts with different HTML markup using a loop
- Change layout of post depending on category
- How to make posts being uncategorized
- How to show category based post in home page?
- How to display a single(current) post from a category
- Sidebar limiting to 10 posts?
- Get posts from current category?
- posts going to 2 pages/categories only show up in 1
- displaying the categories post
- How to show beneath posts the full category path?
- What’s a theme that properly handles previews of different types of posts?
- Display Parent Category of a Post belonging only to Subcategory