Query within meta box
-
Hey gang,
I’m trying to execute a custom query within a meta box to call titles from a different custom post type. The query works just fine, but for some reason the all-in-one SEO plugin meta box that falls below this one isn’t able to call it’s meta values because, as it would appear, I’ve interrupted the loop and try as I may I can’t figure out how.I have tried the ol’ store the post in a variable and then recall it after my custom query loop is done, and that didn’t work either.
Here’s what I’m working with:
<?php // custom query for all posts in the team area $team_query = new WP_Query(); $args = array( 'post_type' => 'team'); $team_query -> query( $args); while ( $team_query->have_posts() ) : $team_query->the_post(); echo '<option value="'; echo the_title(); echo '">'; the_title(); echo '</option>'; endwhile; wp_reset_postdata(); ?>
Any help would be HUGELY appreciated.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Query within meta box’ is closed to new replies.