echo HTML in PHP in WordPress

enter image description here

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:

Thanks for helping

Read more here: echo HTML in PHP in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *