Reputation: 164
I'm trying to use a dynamic field in Wordpress (using custom fields) to generate some link text. However the formatting I am using is certainly wrong as it just prints the words on the page without including them within the link. It's the last line (beginning with echo) that is incorrect. Any ideas, folks?
<?php
$args = array( 'numberposts' => '1', 'category' => CAT_ID );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){
echo '<h3 id="latest"><a href="' . get_permalink($recent["ID"]) . '">' . the_field('report_text') . '</a></h3>';
}
?>
Upvotes: 0
Views: 28