Forums

How to keep a post at top of homepage? (5 posts)

  1. rbro23
    Member
    Posted 3 years ago #

    I've got an RSS feed of related articles coming to my site which is great, but I'd like to have a single post that stays at the top of the home page. How do I do that?

  2. khandu
    Member
    Posted 3 years ago #

    Can someone help in this regards? same issue

  3. langsuyar
    Member
    Posted 3 years ago #

    Depends a lot on what exactly you want to do. What kind of post? Just the latest post? Or a specific post from the database? What code is used to pull the RSS feed?

    Generally speaking, you want to do a loop that queries only one post, for example query_posts("showposts=1", display that post with the_content(). And then get and display the RSS feed. But without knowing what your Loop looks like it's impossible to make specific suggestions.

  4. khandu
    Member
    Posted 3 years ago #

    Mine does not have any RSS Feeds

    I have lots of posts.. But basically want only 1 post to be on top of the page.. and rest new posts to come under it..

    U can assume like an announcement/important/notice post which I want on top and everyone sees that as the 1st post when they come to the website..

  5. langsuyar
    Member
    Posted 3 years ago #

    Do you know exactly which post you want to display first? Create multiple loops for your blog page. In the first one, do a hardcoded query the post that you want to come first and display it with the_content.

    Then create a 2nd loop that does the regular thing of pulling the fist x posts from the database and displays it.

    http://codex.wordpress.org/The_Loop#Multiple_Loops
    http://codex.wordpress.org/Template_Tags/query_posts#Retrieve_a_Particular_Post

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags