Support » Fixing WordPress » using the LOOP to display a single post?

  • 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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    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 :

    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.


    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”

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘using the LOOP to display a single post?’ is closed to new replies.