Forums

[resolved] output post_content with HTML formatting? (3 posts)

  1. mikeespo
    Member
    Posted 1 year ago #

    The post referenced has an ordered list in the content. The problem is no HTML shows up when the code below is used - this is in functions.php.

    Is there a way to output the content with the HTML formatting?

    $postContent = get_post($post_id) -> post_content;
    print_r($postContent);
  2. mikeespo
    Member
    Posted 1 year ago #

    This made the formatting correct:

    $the_post = get_post($post_id, ARRAY_A);
    $postContent = wpautop($the_post['post_content']);
    print_r($postContent);
  3. Stompit
    Member
    Posted 1 year ago #

    Thanks Mike, came in useful :)

Topic Closed

This topic has been closed to new replies.

About this Topic