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.
- To announce something important to the readers.
- To show the best and interesting content to attract the reader.
- 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.
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:
<?php if (!is_paged()) include_once(TEMPLATEPATH.’/featured.php’); ?>
So after adding the code in you index.php it should be like this:
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.
<div class=”static-feature”>This is my announcement for this year</div>
and the corresponding style should be
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:
<?php if( function_exists(“pl_postlist”) ) pl_postlist(“Your 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.
Exclude the posts of a certain categories from WordPress blog home page encore composite structures
If you are using the WordPress platform for your blog and want to exclude the posts of some certain categories then this article may sound well.There are too many ways that help to exclude the posts of a certain category. But I’ll discuss the most appropriate ways that works generally. One important thing you should remember that never try it in hurry. Follow every thing carefully I discussed ( read also : How To Install Your WordPress Blog In Wamp Server). Always take a backup of all of your theme templates before editing them because if you mess up then you can restore the back up.
1.Exclude the post of a certain category by editing the template
You can exclude the post of any category using Query_posts function.For example let us say that you want to exclude the posts from the category with category ID 4. Just open the template named index.php from the theme folder and look for the line
< ?php if (have_posts()) : ?>
Now add this before the line mentioned above.
<?php query_posts($query_string . “&cat=-4″); ?>
By the above process you can exclude undesired category posts from your home page.
To know the category ID just hover the mouse pointer on the Category name in the category list in your WordPress dashboard,the id will appear in the status bar.
There is one back draw of this process.If a post is published under multiple categories then the post will be still visible in the home page.You can avoid this if you post the article which you want to exclude from home page in just one category.
2.Exclude the post of a certain category using WordPress plugin
There is a smart WordPress plugin that allows you to exclude posts from a certain category.
- Download the Front Page Excluded Categories plugin and upload it in the plugin folder under wp-content.
- Now activate it from the WordPress Dashboard.
- Open the plugin Editor and Select the “FrontPage excluded Categories” for Editing.Find for the line
Now include the category ID of which you want to exclude the posts from appearing in the home page.
Now you have done.
Tell us which process you prefer to use. Feel free to share with us.