Support » Fixing WordPress » Variable Conditional Tags

  • (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)
Viewing 1 replies (of 1 total)
  • The topic ‘Variable Conditional Tags’ is closed to new replies.