Title: Custom Field Template within query_posts
Last modified: August 19, 2016

---

# Custom Field Template within query_posts

 *  [rusticated](https://wordpress.org/support/users/rusticated/)
 * (@rusticated)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/custom-field-template-within-query_posts/)
 * I’m currently very new to WordPress, so still struggling to figure things out.
 * I’m setting up a site for a sports tours company. I’ve set up the following basic
   page structure:
 * Sports
    – Football > Team 1 > Team 2 > Team 3 > Team 4 – Rugby > Team 1 > Team
   2 > Team 3 > Team 4
 * However, I need to sub-categorise the sports, so that Football has the subcategories‘
   European Clubs’ and ‘Domestic Clubs’, and Rugby has the subcategories ‘Northern
   Hemisphere’ and ‘Southern Hemisphere’. These subcategories do not need to have
   separate pages, but instead I just want the teams listed under these headings
   on the Football and Rugby pages.
 * I’ve installed the ‘Custom Field Template’ plugin, and set up a custom dropdown
   field called Category, which contains the options ‘Football – European Clubs’,‘
   Football – Domestic Clubs’, ‘Rugby – Northern Hemisphere’ and ‘Rugby – Southern
   Hemisphere’. I’ve then selected the appropriate category for each sport.
 * Now, what I’m struggling with is how I filter query_post to only display posts
   from one of the individual Categories.
 * On each of the sports pages, i.e. Football and Rugby, I’ve currrently got:
 * `query_posts('post_type=page&posts_per_page=-1&&orderby=title&order=asc&post_parent
   ='.$parent);`
 * Is there a way to specify a custom field in query_posts, so that I can make a
   separate page template for each sport, and just manually query the two categories
   for each sport? Or, more complicatedly, is there a way to do this while just 
   having one page template for both of the sports? Or should there be a totally
   different way for me to do this?
 * I’m not sure how well I’ve explained this, so please don’t hesitate to ask if
   there’s anything I need to elaborate on.
 * Thanks,
    Chris

The topic ‘Custom Field Template within query_posts’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * 0 replies
 * 1 participant
 * Last reply from: [rusticated](https://wordpress.org/support/users/rusticated/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/custom-field-template-within-query_posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
