Gediminas
Gediminas

Reputation: 864

WP: the_content doesn't display properly

<p>
<p class="grid_9">
<?php 
echo $post->post_content;
?>
</p>
</p>

But result is not what I expected:

<p> </p>
<p class="grid_9"> </p>
Post's content

Maybe someone has any ideas how to solve it? I tried

<p>
<p class="grid_9">
<?php 
echo apply_filters('the_content',$post->post_content);
?>
</p>
</p>

But the result is the same.

Upvotes: 0

Views: 588

Answers (2)

Juljan
Juljan

Reputation: 2536

The reason might be in the external plugins you have using. Please disable all plugins and try it again. Or make search in the whole project by phrase 'the_content' (including quotes) and try to comment each of them to find the reason.

I saw often in plugins bad usage of basic php/wordpress practices. It might break expected result. For example, I had the same issue in my project on PHP 7.0, because bad written filter in external plugin does not return anything.

add_filter('the_content', 'lbe_myplugin_lightbox');

I disabled it, then fixed the function and everything works fine now. Hope, it helps a bit.

Good luck!

PS It would be nice to know your PHP version as well.

Upvotes: 0

Trey
Trey

Reputation: 5520

Nested paragraph tags don't work properly because the closing </p> is optional, you should use a div, or other container instead of your outside

Upvotes: 1

Related Questions