WordPress.org

Ready to get started?Download WordPress

Forums

Query within meta box (5 posts)

  1. pshero
    Member
    Posted 1 year ago #

    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.

  2. pshero
    Member
    Posted 1 year ago #

    Anyone?

  3. libis
    Member
    Posted 9 months ago #

    i got same problem, anyone can help?

  4. esmi
    Forum Moderator
    Posted 9 months ago #

    @libis: If you require assistance then, as per the Forum Welcome, please post your own topic.

  5. libis
    Member
    Posted 9 months ago #

    @esmi ok, thx

Topic Closed

This topic has been closed to new replies.

About this Topic