placed outside of tag

I am trying to simply output all posts but everything is working fine but I want to add the classes in the tag but the classes gets written in plain text not into the tag.

my code:

<?php
            if (have_posts()) :
                // Start the Loop.
                while (have_posts()) : the_post();
                    echo '<article id="post-' . get_the_ID() . '" ' . post_class() . '>';
                    twentyfourteen_post_thumbnail();
                    the_title('<h1 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h1>');
                    echo '<div class="entry-summary">';
                    the_excerpt();
                    echo '</div>';
                    echo '</article>';
                endwhile;
            endif;
            ?>

I think it has something to do with the chaining but I tried everything… :(

Read more here: Strange misbehaviour with chaining PHP WordPress Post Loop


Solution:

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

Related Wordpress search:

, , , , , ,

Wordpress related questions and answers: