enter image description here

im trying to build a blogsite with wordpress and im trying to show a clickable picture with a link.

            $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>';


I think the echo does not work :/
The result is this:

Thanks for helping

Read more here: echo HTML in PHP in WordPress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: