Title: Variable Conditional Tags
Last modified: August 19, 2016

---

# Variable Conditional Tags

 *  [CowboyFrank](https://wordpress.org/support/users/cowboyfrank/)
 * (@cowboyfrank)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/variable-conditional-tags-1/)
 * (I also posted this in “Hacks” because I wasn’t sure which area was more appropriate–
   apologies for the double-posting!)
 * Here’s a challenge:
    I would like to make a page template that contains conditional
   tags which draw their data from a custom field. For example:
 *  * I have five different user groups – 1, 2, 3, 4 and 5.
    * Each user group has
   a distinct “Information” page. * Each Information page uses the Loop to display
   four different kinds of information – news, events, people, and places – specific
   to each group. * Each kind of information has their own post category. * Each
   User Group uses a Custom Field called “Group,” and the value is equal to their
   name. (i.e. Group 1’s value is “1”)
 * The template should include some code that looks at the Page and says, “On the
   Information Page for Group 1, there is a Custom Field ‘Group’ designation of ‘
   1’. So, where the conditional tag calls for News posts, I’ll display any News
   post which also has the Custom Field Group designation of ‘1’.” This way, I can
   use only one template, rather than having to make a separate template (and/or
   separate News, Events, etc. category) for each User Group. Plus, it makes it 
   way easier to add (or subtract) additional user groups.
 * Does this make sense, or am I making it more difficult than I need to? Please
   help!

Viewing 1 replies (of 1 total)

 *  [shane-g](https://wordpress.org/support/users/shane-g/)
 * (@shane-g)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/variable-conditional-tags-1/#post-1263358)
 * Hi,
 * Refer this article:
 * [http://codex.wordpress.org/Conditional_Tags](http://codex.wordpress.org/Conditional_Tags)
 * Thanks,
 * Shane G.

Viewing 1 replies (of 1 total)

The topic ‘Variable Conditional Tags’ is closed to new replies.

## Tags

 * [conditional tags](https://wordpress.org/support/topic-tag/conditional-tags/)
 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [template](https://wordpress.org/support/topic-tag/template/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [shane-g](https://wordpress.org/support/users/shane-g/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/variable-conditional-tags-1/#post-1263358)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
