im trying to build a blogsite with wordpress and im trying to show a clickable picture with a link.
<?php
$counter = get_posts();
$i = 0;
while ($i < count($counter)) {
$args = array( 'posts_per_page' => 1,'offset' => $i );
$i = $i + 3;
$lastposts = get_posts( $args );
foreach ( $lastposts as $post ) :
setup_postdata( $post );
$permalink = the_permalink();
$thumbnail = the_post_thumbnail_url();
echo '<a href="'.$permalink.'"><img src="' . $thumbnail . '"> </img></a>';
/*the_post_thumbnail();*/
endforeach;
wp_reset_postdata();
}
?>
I think the echo does not work :/
The result is this:
<div class="col span_1_of_3">
This is column 1 http://lena.sbstn.net/2017/04/14/ein-neuer-post/http://lena.sbstn.net/wp-content/uploads/2017/01/22.jpg
<a href=""> <img src=""> </a>http://lena.sbstn.net/2017/01/29/new-york-cheesecake/http://lena.sbstn.net/wp-content/uploads/2017/01/image2-525x700.jpg
<a href=""> <img src=""> </a>
</div>
Thanks for helping