Conditional loop in page
-
The issue:
I have a lot of pages for soccer teams (u11’s, u15’s, etc…) on a single website. They contain useful information about the team that is input by custom fields. I therefore also use a page template.
I would like to add a ‘blog’ section (by using a loop) on those pages so every coach can post information for their team.the easiest way is to create a category for each team. I could create a template and manually change the preset information (and lose my custom fields).
Then I was thinking about the possibilty of using the loop (query_posts/WP_Query) in a page – so page info + loop -? I guess this is not possible (I’m using WP for couple a years now, but never countered the question …)! If this can be done, my problem would be solved.
On the other hand, I can create a page template with custom fields by adding a loop for each category. Then I should create about 20 templates. This does not sound very practical, but is doable.
Then I figured I maybe could use conditional statements in one page template. I could use the custom fields and write a loop using a large condition depending on the category that is used (if page is U13, then use loop is_category U13…).
I don’t know if this is possible (+ I guess it’s complex to do).What do you think, is the last option possible, and if so, how to start? Maybe you guys know other possibilities that can be used (using 1 category with tags (u9, u11,…) I can use with conditional statements)?
- The topic ‘Conditional loop in page’ is closed to new replies.