skip to Main Content

I came across the same question on StackOverflow but the answer given to it is not working for me. I am facing the same issue as mentioned in this link and my content is showing like this: Screenshot

Can anyone guide me on how to solve this issue? My front page was fine as long as I had not added the_content() to it.

2

Answers


  1. Chosen as BEST ANSWER

    So finally I found the reason behind this issue. When I saw the code of page displayed in the browser using inspect then I found that wherever I was using the_content() WordPress was actually inserting content by enclosing it within HTML code as:

    <section class="social-post-top">
    <div class="container social-post-top-container">
    <div class="social-post-top-content">
    <div class="excerpt">Tincidunt tortor aliquam nulla facilisi. Enim blandit volutpat maecenas volutpat blandit. Amet volutpat consequat mauris nunc congue nisi vitae. Fames ac turpis egestas sed tempus urna et pharetra pharetra. Et netus et malesuada fames ac turpis egestas sed. Pellentesque id nibh tortor id aliquet. Venenatis lectus magna fringilla urna porttitor rhoncus dolor. Morbi tristique senectus et netus et malesuada fames ac. Interdum velit euismod in pellentesque massa placerat duis. Eget velit aliquet sagittis id consectetur purus ut faucibus. Nunc non blandit massa enim nec. Nibh mauris cursus mattis molestie a. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Lectus proin nibh            </div>
            </div>
        </div>
    </section>

    where the content was only:

    Tincidunt tortor aliquam nulla facilisi. Enim blandit volutpat maecenas volutpat blandit. Amet volutpat consequat mauris nunc congue nisi vitae. Fames ac turpis egestas sed tempus urna et pharetra pharetra. Et netus et malesuada fames ac turpis egestas sed. Pellentesque id nibh tortor id aliquet. Venenatis lectus magna fringilla urna porttitor rhoncus dolor. Morbi tristique senectus et netus et malesuada fames ac. Interdum velit euismod in pellentesque massa placerat duis. Eget velit aliquet sagittis id consectetur purus ut faucibus. Nunc non blandit massa enim nec. Nibh mauris cursus mattis molestie a. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Lectus proin nibh

    Did not get the reason why it occurred may be due to some plugin or some other reason as I was not adding any HTML to $content using add_filter("the_content",'anyfuncname') in functions.php but for solving this issue, I then added add_filter to functions.php as:

    function bts_add_html_to_content( $content ) {
    $new_content=strip_tags($content);
    return $new_content;
    }
    add_filter( 'the_content', 'bts_add_html_to_content', 99);
    

    So I used the strip_tags() function of PHP for stripping string which was the main content from $content. So this is how I solved this issue.

    Hope this answer will help someone else in future


  2. Rather than updating from frontend using css ,now follow the columns blocks in WP Block Editor to achieve what you want .enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search