Passing a variable to query_posts
-
I’m trying to build a page template for a set of custom archive page templates. There’s going to be a bunch, so I am trying to write a single template that I can pass a variable set in a page custom field that sets what category_name is. I’ve got all the other pieces working, but I can’t get the $category variable to do what it needs to. I’m sure this is totally basic, but I’m stumped right now.
<?php $category = get_post_meta($post->ID, "CategoryName", true); if ($category){ query_posts('showposts=10&category_name=echo $category'); } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Passing a variable to query_posts’ is closed to new replies.