PHP Variable in WP_Query
-
The blog im working on will be highlighting some items. For every item there will be 3 posts (Story, Blog, Press Release) I want to display them on one page based on the story. The 3 posts will have a unique tag only unique to that item. Ive figured out how to generate that tag based on pulling it from the story. Now i need to get it added to the other queries. The code below works with the tag hard coded in:
$my_query = new WP_Query('cat=10&tag=uniquetag'); while ($my_query->have_posts()) : $my_query->the_post(); the_content(); endwhile;
but not when used with the php variable
$my_query = new WP_Query('cat=10&tag='.$myvariable); while ($my_query->have_posts()) : $my_query->the_post(); the_content(); endwhile;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP Variable in WP_Query’ is closed to new replies.