The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress 3.1 – How can loop from index.php be modified to show a single post.

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #32700

    I want the index.php to display a specific post, but I don’t want to change how many posts are displayed on other pages by changing “Blog pages show at most” in settings.

    So… it seems like I need to modify the loop.php on index.php. It may be easiest for me to add the new php to index.php rather than messing with the loop.php.

    I’ve been using Starkers as a blank theme to start templating from.

    Thank you


    i’m not entirely sure if i understand you, but I think what your asking is how can you change the index.php’s loop to show only 1 post without effecting the other pages. I think all you have to do would be to add something like

    and where ‘page_id=7’ is just put the id of the post you wish to show.

    i cannot remember off hand exactly how to do it, but theres a way to reset the query_posts thing once a loop is finnished so that you can create another one, if you watch Chris’ screeencast called “The WordPress loop” you’ll see it.


    To follow up on mshort’s response, to reset the query, use


    immediately after the endwhile statement in the loop. Had to use that about 10 times on one project, so I can guarantee it works. :)


    Sorry if this is a “duh” question, but: where in the index.php do I paste


    That goes before your loop begins. Before the ‘if have posts while have posts…”.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.