WordPress.org

Ready to get started?Download WordPress

Forums

Conditional Double Query? (2 posts)

  1. echstudios
    Member
    Posted 5 years ago #

    Let's see if any of you can crack this one...

    I have a Projects Category with 3-sub categories: Sub1, Sub2, & Sub3 (Note only the subcategories will be used with posts).

    The Project's Category Template (just the 1) must handle:

    • a) All queries of the "Projects" category
    • b) All queries of any of 3 sub-categories
    • c) All queries of single posts under any of those categories.

    Simple enough, right? Well here's the real kicker...

    The template will be running two loops that must function as follows:

    1) If the template is loaded on a "Projects" query,

    • the loop must display all "Projects" posts as normal.
    • When that is done, it needs re-query and display just the latest post from that query.

    2) If the template is loaded on a "Sub-Category" query,

    • the loop must display all posts from just that specific "sub-category" as normal.
    • When that is done, it needs to re-query and display just the latest post from that query.

    3) If the template is loaded on a "Single" query,

    • the loop must display all post from the entire "Projects" categegory, however, the single post must be first.
    • When that is done, it needs to re-query and display just the single post.

    Anybody want to give that one a go? I'm sure I'll be waiting for a while...

    Pre-thanks!

  2. echstudios
    Member
    Posted 5 years ago #

    Come on...

    I know some guru would find this one fun.

Topic Closed

This topic has been closed to new replies.

About this Topic