Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

blogoguru on "trying to display thumbnail as a link"

$
0
0

hi!
here is a code I came up with to display 5 latest news with thumbs

<?php
    $args = array( 'numberposts' => '5' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){
echo '
<li><a>' .   $recent["post_title"].'</a> </li>
 ';
 if ( has_post_thumbnail($recent["ID"])) {
            echo '
<li>' . get_the_post_thumbnail($recent["ID"], 'mini70') . '</li>
';

        }
    }
?>

The problem is I'd like to display the thums as a link also but whatever I tried did not work
any help appreciated
thanks


Viewing all articles
Browse latest Browse all 8245

Trending Articles