• I’m trying to display a given post title under each post image (they are positioned in a grid). So far I’m only getting the current page url.

    <?php
    	  $thumbnails = get_posts('numberposts=15');
    
    	  foreach ($thumbnails as $thumbnail) {
    		if ( has_post_thumbnail($thumbnail->ID))
    		 {
    		echo '<div class="case">';
    		echo '<li><a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
    		echo get_the_post_thumbnail($thumbnail->ID, 'large');
    		echo '</a></li>';	
    
    		echo '<a href="' . get_post_permalink( $ID ) . '">' ;
    		echo get_the_title($ID); '</a>';
    		echo '</div>';
    		}
    	  }
    	?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display post url under post featured image’ is closed to new replies.