Forums

Displaying only one post from a specific category including all other categories (4 posts)

  1. chandlerepp
    Member
    Posted 8 months ago #

    Over at my website, http://whateverisright.com/, I'm trying to edit the main loop to make the site more functional.

    I need to find some kind of query/coding to allow me to show 5 or 6 posts (like it does now), but only show one post from the "Greatest Hits" category. Basically, I want it to display all the other categories like usual, but only the most recent post from that one specific category.

    I do not want to do two separate loops because then I would have to break up the posts, and I don't want that. I still want it to show the most 5-6 recent posts, but out of those 5-6 posts to only show the most recent "Greatest Hits" post with no restrictions on the other categories.

    Can anybody help me out?

  2. MichaelH
    moderator
    Posted 8 months ago #

    I do not want to do two separate loops because then I would have to break up the posts,

    Not too sure what you mean by that--so what if you have two loops?

    Have you considered using the sticky post feature?

  3. chandlerepp
    Member
    Posted 8 months ago #

    It was my understanding that if I used two loops, the posts would be separated. What I mean is, I want the most recent 6 posts to display *in descending order* from most recent to least recent. If I used a loop for the non-GH category posts and then a loop for the single GH-category post, wouldn't they not display in the proper order anymore?

    For example: instead of Post 1, 2, 3, 4, 5, 6. It would have to be all the posts that are not in the GH category (i.e. 1,2,4,5,6), and then separately (not mixed in) it would have Post 3 at the beginning or end. Am I wrong about that?

    As for the stickies: I guess I could use that but is there some kind of automated plug-in that sticks the most recent posts to the homepage, but then un-sticks the ones written after that?

    I don't really know PHP that well, that's why I'm asking all this. Thanks for your replies.

  4. MichaelH
    moderator
    Posted 8 months ago #

    For example: instead of Post 1, 2, 3, 4, 5, 6. It would have to be all the posts that are not in the GH category (i.e. 1,2,4,5,6), and then separately (not mixed in) it would have Post 3 at the beginning or end. Am I wrong about that?

    Correct.

    How about a 'Random Featured Post' plugin? e.g. http://wordpress.org/extend/plugins/random-featured-post-plugin/

    generic:
    http://wordpress.org/extend/plugins/tags/featured

Reply

You must log in to post.

About this Topic