- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Posted this on the WordPress.org forums but am hoping someone here can help also. I am not sure if this can be done but am hopeful :)
I need to use multiple query_post on a new site I am working on. They will all be very similar besides one specific value in each. Instead of having to create 50 separate page templates, I was wondering if the following would be possible. Use a custom field on each page titled age. Then pull the value of that custom field and add it into the query_post. That way I can use just one template and change each query_post based on the custom field.
So that way on the page that uses the custom field age of 12, the query post will return only posts with the category 12. I will be using more than just that one category in the query_post but they will all be staying the same across all pages, the only change will be the age.
Hope it makes sense. Would hate to create all those different template files just to change one value on each.
Your example isn’t entirely clear but from what I gather, it sounds like you want to run a custom select query. See this for reference:
http://codex.wordpress.org/Displaying_P … lect_Query
Scroll down to where you see:
"Query based on Custom Field and Category"
Is this along the lines of what you are looking for?