I'm trying to get formating but with no luck. My code looks like this

global $post;
$content = $post->post_content;

And to output here

<div class="tribe-events-single-event-description tribe-events-content">'.$content.'</div>

Please if anyone have suggestions let me know.

  • is this in a theme? Is there any reason why you can't use the_content() as normal between your opening and closing div tags? Apr 5, 2018 at 11:38

1 Answer 1


If i get your question correct, you want the post_content formatted like the content put out by the_content, right?

Change your upper code like this:

global $post;
$content = apply_filters('the_content',$post->post_content);

This does everything to your content that would be performed when outputting it by the_content();

If you only want the p and b tags, you can use wpautop($post->post_content) instead.

  • 1
    Thanks @kuchenundkakao apply_filters didn't work for some reason I have tried that before. But wpautop did! Apr 5, 2018 at 13:14
  • Hm, weird... If you want to have shortcode execution also, you can change the code to wpautop(do_shortcodes($post->post_content)) Apr 5, 2018 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.