Loop Issue
-
Trying to insert the URL for any given organization into a list of search results. The following inserts the post metadata for the custom field ‘link’ but inserts the first item’s URL for all subsequent items in the results. Obviously, I need the URL for each individual organization. Not sure what I am missing.
<!-- Loop --> <?php $link = get_post_meta(get_the_ID(), 'link', TRUE); if ( have_posts() ) { while ( have_posts() ) : the_post(); ?> <p><a href="<?php echo $link; ?>"><?php the_title(); ?></a></p> <?php get_template_part( 'parts/content', get_post_format() ); endwhile; } else { ?> <div class="no-results"><p><?php _e('No posts found.', 'vega'); ?></p></div> <?php } ?> <!-- /Loop -->
Any assistance appreciated.
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Loop Issue’ is closed to new replies.