WordPress.org

Ready to get started?Download WordPress

Forums

I am frustrated beyond belief! (8 posts)

  1. crisispictures
    Member
    Posted 8 years ago #

    Help.

    I'm sure someone has answered this, so a link would be gratefully received.

    While in the middle of a loop,I want to list 5 posts from that category (which is a child of another category) by title.

    I'm stumped.

  2. Kafkaesqui

    Posted 8 years ago #

    Need a bit more explication on this to make sure I understand what you're asking for.

    Where is this "middle of the loop" -- is this meant for a single post, or all page query types, or what? You want 5 posts from the category the current post is in, correct? That it's a child of another category is important in some way to the handling of these other 5 posts? Since you mention this, is this ONLY for a specific category (this child category)? You didn't provide a lot to go on.

  3. crisispictures
    Member
    Posted 8 years ago #

    Thanks a LOT for looking at this. I'm on day two of quitting smoking. you may save a life.

    This is for a single post page. (single.php)

    The categories i'm concerned with are structured like this:

    News
    Region (ie: n america, s america, middle east etc)
    Country

    So, let's say I have a story from Bahrain.

    That would be News > Middle East > Bahrain.

    What i'd like to do is at the same time show the titles five most recent posts from Bahrain in an unordered list.

    I'm using lots of fiddly custom metatags on my page, which makes it hard to do one loop for the single post and then another for the 5 previous posts.

    I'm stumped.

  4. TechGnome
    Moderator
    Posted 8 years ago #

    you may want to try reading this about using multiple loops. See if that helps.

    -tg

  5. crisispictures
    Member
    Posted 8 years ago #

    yea.

    read it.

    doesn't solve my problem, sadly.

  6. TechGnome
    Moderator
    Posted 8 years ago #

    You could also include the posts by using one of the RSS feed plugins....

    -tg

  7. Firas
    Member
    Posted 8 years ago #

    What have you tried from that article, and why doesn't it solve your problem? get_posts is what you need. It'll work.

  8. crisispictures
    Member
    Posted 8 years ago #

    it did work.

    yes, yes it did.

    i didn't really understand php syntax-- i was putting string variables inside single quotes.

Topic Closed

This topic has been closed to new replies.

About this Topic