Use value of a custom field inside query_posts
-
Hi. 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.
- The topic ‘Use value of a custom field inside query_posts’ is closed to new replies.