• Resolved dfwgreg

    (@dfwgreg)


    Hi everyone,
    Is there a way to take the value from a custom field and put it in a wp_query loop?

    I need to find a way to get the text from custom field groupip and put it in the wp_query loop to a custom taxonomy group_post. This is what I’ve done so far:

    <?php if ( get_post_meta($post->ID, 'grouping', 'on') ) { ?>
    	<?php $my_query2 = new WP_Query('group_post=<?php $link = get_post_meta($post->ID, "groupid", true); echo $link; ?>&posts_per_page=-1'); ?>
    	<?php while ($my_query2->have_posts()) : $my_query2->the_post(); ?>
    	<ul class="group-items">
    	<li><?php the_title(); ?></li>
    	</ul>
    	<?php endwhile; ?>
    	<?php }?>

    Thanks,
    Gregory S.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add text from custom field to wp_query’ is closed to new replies.