To customize a Blog Sticky Post, we must first locate and fetch the sticky post.
Steps to Fetch Sticky Post
- Sticky posts are setting through the option ‘Stick to the top of the blog’, which is available from the right side of the post page.
Check or uncheck to set the sticky post. - If we set more than 1 post as sticky, there latest sticky post from the selected option will be displayed.
- If there is no sticky post selected, then latest post will be displayed for featured blog.
- Code to Fetch sticky post:
<?php $args = array( 'posts_per_page' => 1, 'post__in' => get_option( 'sticky_posts' ),'ignore_sticky_posts' => 1 ); $query = new WP_Query( $args ); ?>
Now we can customize the fetched Sticky post and set as featured post.