How to create a customized Featured Section for WordPress blog

Posted by Tanmay

If you are a regular blogger then you should see in some blog there is a featured section or showcase where they show the latest announcements. When I started blogging then I wanted to place a featured  Intro section where I wanted to publish the Interviews of some famous blogger. So here I discussed about how to create a custom Featured section for a WordPress blog. Also read :  Add Widgets Any Where In Your WordPress Blog

Read also: Moderate WordPress Blog Comments From Desktop

The Purpose of placing a featured section in your WordPress blog

A featured section is a special portion of your WordPress blog(Usually your homepage). It reflects the special content or announcement from the Author.It highlights your best post,a custom message or photos,videos or anything you want, to draw the readers’ attraction.You can use your featured section in various purpose.But here is some common purpose for that the featured section is generally used.

  1. To announce something important to the readers.
  2. To show the best and interesting content to attract the reader.
  3. To show Photos,Videos from other source.

Which is the perfect place for the Featured Section in your blog?

There is no bound to place the Featured section. You may place it anywhere you want like Homepage, sidebar or Footer. But the Ideal place of the Featured section is the homepage and above the fold.

softslas-featured-intro-section

How to Start for designing the feature section for your blog

You can create the Featured section in you desired places like in homepage, sidebar or footer editing the corresponding template files. That is if you wish to place your Featured section on your homepage then you need to edit index.php. For sidebar you have to edit sidebar.php. In general the Featured section is used in the homepage and I’ll discuss the technique to create a Featured section in the homepage. You ca apply this technique for the sidebar or footer also.

Open the template in notepad and paste the following code:

<div class=”featured”>My First Featured Section</div>

Save the file as featured.php and upload it in your current theme folder. Keep in mind that you should upload the file featured.php in the same location where the index.php file resides.

How to call the featured page  from the index.php

If you want to show your featured section in your homepage just above the posts then open the index.php file and look for the line stated below:

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

Now paste the following directly above those codes:

TEMPLATEPATH.’/featured.php’); ?>

So after adding the code in you index.php it should be like this:

call-featured-section-in-homepage

Otherwise if you want to show the featured section in elsewhere then call the code I stated above in the appropriate position depending on your theme codes.

Coding and styling of the featured.php page

After successful calling of the featured.php page from index.php you may add some code and style in the featured.php.

Case A:If you want to show a static Notice or Announcement in the Featured section in the home page

In that case write your announcement within a unique class in the featured.php and include the corresponding styling in the style.php file.

As example;

<div class=”static-feature”>This is my announcement for this year</div>

and the corresponding style should be

.static-featured {width:600px;height:200px;background:#666666;}

Case B:If you want to show the latest post from a particular category

You may want to highlight a particular post e.g an interesting monthly post in your Blog home page. You can see the Interview series of some famous blogger which has been started recently in our home page.In this section the latest post has been shown.

So let’s see how to solve it. For this scenario we shall use a WordPress Plugin Postlist. After installing the plugin select the category from where you want to include the post in the Featured section and you can also select the number of post to be shown in the Featured section. There are many other option that you can set as your need.e.g automatic update option and many more. After getting ready your list just call the list in the featured section. The simple code is:

category name");?>

Now all you have done.

N.B As the code of different themes are not same you may face some problems.But we are always here to help you. Feel free to share your experiences and problems with us in the comment section of this post.

This post was written by Tanmay

Reader Comments

  1. No comments yet.