How to add a Featured Post section to your WordPress Blog?

In this post I’ll be giving a small but efficient tutorial to add a Featured Post to your WordPress Blog. There are a lot of posts available over different sites and here I’ll explain how to do it with ease..!!

Image of featured post section at Devils Workshop

Now, you have to edit 3 files of your currently used theme to set this up:

  • Functions.php
  • Style.css (stylesheet)
  • Home.php (home page template)

1. Editing Functions.php

Open the functions.php file of your template and just add the code given in following file to it and save it.

CLICK HERE TO GET THE CODE

NB: You may add this at the first line or last line if you dont know where to add.

2.Editing Style.css

Open the stylesheet file in the themes folder and add the following codes to it.

#featured {
float:left;
background:#f1f1f1;
margin:5px 10px;
}
#featured_title {
float: left;
width: 125px;
font-size: 120%;
font-weight: bold;
padding: 15px 10px;
}
#featured_content {
float:left;
width: 445px;
padding: 0px 10px 10px 10px;
text-align: justify;
}

Now, the next task is to add a code to the home page such that it shows your featured post.
Your theme may sometimes have a seperate home page(home.php) file or some times an index(index.php) file which is used to show the individual post as well as the home page.
If your theme donot have any home.php file you have to create it. Just copy paste the entire content in index.php and save this as home.php.

Now refer to the following screenshot and add the code just where it is in screenshot.
This is the code that you need to add.
code to be added to home.php

Screenshot

Screenshot

The basic things are done.

How does it work?

Once you are done with this, add a category called FEATURED. Be sure that the spelling is the same as it works on this.
Now head to add-post section and write an article that has to be posted. If it is a featured post mark the category as FEATURED and publish it.

Now, this is done. If you have queries do ask in the comment section here. :)


[Editor's Note: This post is submitted by our guest blogger Arjun S Kumar.

If you, too would like to write for Devils Workshop, please check this. Details about our revenue sharing programs are here.]

No related posts.

  • http://www.orkutplus.net/ Gautam

    There are many wordpress plugins to do the same thing… you can list some of them here too…

  • http://orkutbuddy.com Arjun S Kumar

    @ Gautam

    I explained how to do this without any plugin. :P

  • http://www.shoutmeloud.com Harsh Agrawal

    Gautam which plugins you are talking about?

    @ Arjun
    Nice tut…

  • http://www.beepthegeek.com Gagan

    @ Arun

    When I opened OrkutBuddy, Firefox said :

    “This web site at http://www.orkutbuddy.com has been reported as an attack site and has been blocked based on your security preferences”

    hmmmm

  • http://orkutbuddy.com Arjun S Kumar

    @Gagan
    Thanks for notification. Dont know why it is so, i never saw anything like that. Did anyone else saw that..??

    BTW I’m not Arun I’m Arjun …Okay Gagan..

  • http://www.tricksdaddy.com Simran

    @ Arjun

    I too saw this warning !!!

  • http://orkutbuddy.com Arjun S Kumar

    @ Simran

    Ok..

    I’ll take guard of it..

  • http://www.orkutplus.net/ Gautam
  • http://www.beepthegeek.com Gagan

    sorry Arun, oh Arjun :p

  • http://orkutbuddy.com Arjun S Kumar

    @ Gagan and @ Simran

    Yaar I have cleared the badwares at orkutbuddy.

    Please do inform me if you get the same message again..

    :O

  • http://www.tricksdaddy.com Simran

    @ Arjun

    Its opening now :(

    • Rahul Bansal

      @All
      OrkutBuddy never had any badware hosted on itself.
      It is hosted on shared server where we have some bad neighbors.
      I have opened a support ticket with Dreamhost.
      Lets see what they say about this.

      @Gautam

      Its always better, NOT to use plugins for trivial stuff.

  • http://blogadgetech.com neer

    Hey Arjun,

    first of all nice script…

    It still dont allow downloading

    So please take it to other host and provide us the links

  • http://www.crimechamber.com Srinivas

    My avast even shows It has detected a trojan when i forcefully visit the site and asks me to abort connection

  • http://www.orkutbuddy.com Arjun S Kumar

    @neer and @ Srinivas

    Ya I’m aware of that and will be fixing it soon..

  • http://www.shoutmeloud.com Harsh Agrawal

    @Gautam
    thanks for the link

    @Rahul
    That featured slider plugin gives a whole new look to the blog. Though down side is it will increase the page loading time by few sec..

  • Pingback: Add Pagination to your WordPress Blog without Plugin!

  • Rishabh

    The attack warning is still there..

  • http://orkutbuddy.com Arjun S Kumar

    @ Rishab

    Ya..
    Thanks for the info..

  • M8ke

    That’s what i was looking for…
    One question tho : what code do i have to insert to get my featured post NOT duplicated in my posts content ??

  • http://firstain.com/ karan israni

    Is there a way to display 5 featured posts with thumbnails at the top on my homepage? They’ll just show thumbnail and one line of the concerned post. And yeah, ‘I’ get to decide which posts appear there.

    So, is it possible? How?

  • Pingback: [GSoC] Project Proposal Application | nikibee.in! Online photography hut

  • Jenny

    Is it possible to add an thumbnail image with the post? If so, please let me know how.

  • http://thecclaw.com Ottilie

    I stupidly added the PHP to my functions.php file and now my website is not loading whatsoever. No login page, no dashboard, just white pages. How do I fix this?

  • http://getrid4sure.com nick

    Is it possible to see a demo of this featured post? I dont wanna go through it all only to find out i dont like how it looks, lol