The first thing you should know is that Featured Post has not been available in WordPress for a long time. But we can still create it ourselves by writing query from our tags or categories names.
- You just create a post as simple as you can.
- Create tag name as “Featured” then add into your recently post.
- Implement some codes to call it or just copy the code below:
<?php
$last_posts = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 1,
'post_status' => 'publish',
'post__not_in' => get_option('sticky_posts'),
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'field' => 'name',
'terms' => 'Featured',
),
),
'orderby' => 'rand',
'order' => 'desc'
) );
if($last_posts->have_posts()):
$last_posts->the_post();
//display your code loop here
endif;
?>
That’s it. If you like this post, please give us some thumbs up.