How to display posts from specific category on the front page as feature in Worpress website.

To implement a selective blog feed that can be placed on a front page template or anywhere else in the design.Many CMS implementations feature some selected items from the blog feed on the home page, or even throughout the site in a sidebar or footer element

1st Step: Go to Post and Create the Categories named Featured.

2nd Step :-Create Post and Select Categories by checkbox from Right Hand-side Bar.

Example:-a)We create Featured of one and select categories Featured by checkbox .As picture below

b)We create Featured of two and Featured of three and select categories Featured by checkbox .As picture below

To classify posts as “Featured”; a category named “Featured” or “Front Page” is a good convention. For the content editor, marking a post as “featured” is as simple as adding it to this category(remember: posts can have multiple categories). On the template side, theID of the “featured” category will be needed. The easiest way to find the category ID is by rolling over the category “edit link” inside WordPress admin and noting the ID in the URL (typically in the status bar).Using this ID (“2′′ in the example), and the number of posts to feature on the home page is 3, the following code will list the featured posts beginning with the recent ones.

3rd Step :-Copy the code and paste in front where we want to show the Featured category post.

<?php
echo "<h2>Featured Blog Posts</h2>";
echo "<ul>";
$feat_posts = get_posts('numberposts=4&category=2');
foreach ($feat_posts as $feat) {
echo '<li><a href="'.get_permalink($feat->ID).'">'.$feat->
post_title.'</a></li>';
}
echo "</ul>";

?>

This code can be extended in a number of ways

Its will show like this in Front Page.

Featured posts link and its details page look like this:

Enjoy the articals.

Total Page Visits: 7485 - Today Page Visits: 1

Leave a Reply