Demo of a Featured Post
You probably have stories in your blog you want to highlight to your readers. This is commonly referred to as „Featured Posts“ or „Featured Content“. If you are using WordPress, displaying these featured posts can be achieved in various ways, one of which is using a plugin like Jetpack.
Jetpack consists of the features that we find in WordPress.com. At the time of the writing, it holds 30 features including WordPress.com Stats, Photon, Infinite Scroll, and our focus of the day, Featured Content. Let’s get to it.
We will add a few lines of code to display the featured content in our theme. And, as an example in this tutorial, I’m going to use TwentyTwelve.
Usually the featured content is displayed on the front page. If your theme follows the WordPress standard theme strucuture, the front page is rendered either in index.php, home.php, or front-page.php.
The above conditional statement will show the featured content if at least there is one present and while the page is not being paged (it is not in the second page onwards).
Additionally, we can also set a new thumbnail size for the featured content. In this example, I created a new size, which is 250 by 160 pixels. You can add the following code somewhere below the add_theme_support( ‚post-thumbnail‘ ).