When I getting the post in wordpress in the result I have the <div> wrapped <strong> and <em>

When I getting the posts in wordpress loop, in the result I have the div wrapped strong and em.
This is my code (I just created the news page):

 <?php
                function content($limit)
                {
                    $content = explode(' ', get_the_content(), $limit);
                    if (count($content) >= $limit) {
                        array_pop($content);
                        $content = implode(" ", $content) . '...';
                    } else {
                        $content = implode(" ", $content);
                    }
                    $content = preg_replace('/[.+]/', '', $content);
                    $content = apply_filters('the_content', $content);
                    $content = str_replace(']]>', ']]&gt;', $content);
                    return $content;
                }
                ?>
                <?php
                $news = new WP_Query(array(
                    'post_type' => 'post',
                    'category_name' => 'news'
                ));

                if ($news->have_posts()) : ?>
                    <?php $counter = 0;
                    $isLeft = false;
                    while ($news->have_posts()) : $news->the_post(); ?>
                        <?
                        if ($counter % 5 == 0) {
                            if (!$isLeft) {
                                echo '
                                 <div class="col-sm-6 col-md-6 col-lg-6 block-big">
                            ';
                                $isLeft = true;
                            } else {
                                echo '
                                 <div class="col-sm-6 col-md-6 col-lg-6 block-big" style="float: right;"  >
                            ';
                                $isLeft = false;
                            }
                            echo '
                            <a href="' . get_the_permalink() . '" class="article">
                                <div class="date-label">'.get_the_date('j F ').'</div>
                                <div class="img-block">
                                    <img src="' . get_the_post_thumbnail_url() . '" alt="">
                                    <div class="icons-block">
                                        <span><i class="icon-1"></i>88</span>
                                        <span><i class="icon-2"></i>3</span>
                                        <span><i class="icon-3"></i>11</span>
                                    </div>
                                </div>
                                <div class="text-block">
                                    <h4>' . get_the_title() . '</h4>
                                    <p>'.content(60).'</p>
                                </div>
                            </a>
                        </div>
                        ';
                        } else {
                            echo '
                        <div class="col-sm-6 col-md-3">
                            <a href="' . get_the_permalink() . '" class="article">
                                <div class="img-block">
                                    <img src="' . get_the_post_thumbnail_url() . '" alt="">
                                    <div class="icons-block">
                                        <span><i class="icon-1"></i>88</span>
                                        <span><i class="icon-2"></i>3</span>
                                        <span><i class="icon-3"></i>11</span>
                                    </div>
                                </div>
                                <div class="text-block">
                                    <h4>' . get_the_title() . '</h4>
                                    <p>'.content(50).'</p>
                                </div>
                            </a>
                        </div>
                        ';
                        }
                        $counter++;
                        ?>
                    <?php endwhile; ?>
                <?php endif; ?>
                <?php wp_reset_query(); ?>

Result HTML (look the image) :
enter image description here

Read more here: When I getting the post in wordpress in the result I have the <div> wrapped <strong> and <em>

Leave a Reply

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