• Hi all!
    As the title say, I’m having a bit of trouble getting the content of a specific page with formatting.

    I’m using this code, (found here), to add the content into an horizontal accordion that I’ve added to sidebar.php, (I’m not using any kind of widget, because I don’t need them form this specific project):

    <?php
    $my_id = 129;
    $post_id_129 = get_post($my_id);
    $content = $post_id_129->post_content;
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
    ?>

    and it works perfectly, (see here, just open the “La Storia” tab in the horizontal accordion; the original page from which I’m getting the content is here), but I’m not getting the whole formatting: as you can see, the text is bold where I need it to be, but the breaks are missing.

    I’ve already added this into my functions.php:

    <?php
    // get_the_content with formatting
    function get_the_content_with_formatting ($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
    $content = get_the_content($more_link_text, $stripteaser, $more_file);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    return $content;
    }
    ?>

    but, while it works like a charm if I use it into a text widget, it’s not workin right now.

    Thanks in advance for any help you may give me and have a good day/night!

  • The topic ‘Getting content of a specific page with formatting’ is closed to new replies.