WordPress.org

Ready to get started?Download WordPress

Forums

using the LOOP to display a single post? (4 posts)

  1. podpersonjason
    Member
    Posted 9 years ago #

    hey

    i'm trying to figure out how to use the loop to display a single (the most recent) post. i have loop with several if/then sequences to change the apperance based on catagory number or location in my site, but i'm trying to find a way to have a single post shown.

    clearly, i don't want to change the 'viewing' settings in the control panel, and tacking some bits of code to the top of the page won't do either, because it would effect all subsequent loops. i need SOME kind of way to limit the return to a single post, but i can't figure out how to do that exclusively from within the loop. any suggestions?

    i'm using WP 1.5.2, i looked on the codex, but it wasn't much help. thanks!

  2. Kafkaesqui

    Posted 9 years ago #

    Look again at Codex, but examine the multiple loop examples on the page covering The Loop, and the use of query_posts() with the 'showposts' parameter.

    http://codex.wordpress.org/The_Loop#Multiple_Loops

  3. podpersonjason
    Member
    Posted 9 years ago #

    thanks kaf, but i've looked thru all of the multiple loop examples on the codex and wasn't able to find anything that really helped. the closest i found was this : http://codex.wordpress.org/Conditional_Tags

    where i used the 'variable sidebar' example to hack together something that would let me load different css for different categories, but it still doesn't do a thing towards limiting the output to one post.

    in fact, i searched the codex for 'showposts' and got zero results back, so i'm really not sure where to find info on that parameter? i've seen a bunch of examples on how to display a single post differently, but none to display ONLY a single post, when there are several available.

    thanks!

  4. podpersonjason
    Member
    Posted 9 years ago #

    ha! i'm a genius; the 'go' button was activtating when i hit [enter], instead of the 'search' button. now i see all kinds of results for "showposts"

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags