Title: Conditional Double Query?
Last modified: August 19, 2016

---

# Conditional Double Query?

 *  [echstudios](https://wordpress.org/support/users/echstudios/)
 * (@echstudios)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/conditional-double-query/)
 * 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!

Viewing 1 replies (of 1 total)

 *  Thread Starter [echstudios](https://wordpress.org/support/users/echstudios/)
 * (@echstudios)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/conditional-double-query/#post-879905)
 * Come on…
 * I know some guru would find this one fun.

Viewing 1 replies (of 1 total)

The topic ‘Conditional Double Query?’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [loops](https://wordpress.org/support/topic-tag/loops/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [single](https://wordpress.org/support/topic-tag/single/)
 * [Sub-Category](https://wordpress.org/support/topic-tag/sub-category/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 1 reply
 * 1 participant
 * Last reply from: [echstudios](https://wordpress.org/support/users/echstudios/)
 * Last activity: [17 years, 8 months ago](https://wordpress.org/support/topic/conditional-double-query/#post-879905)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
