WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Stripping Tags :( (4 posts)

  1. mattblank
    Member
    Posted 1 year ago #

    Hi!

    To include a page's content into my template, I'm using the below code:

    <?php
    $post_id = 5220;
    $queried_post = get_post($post_id);
    ?>
    <div class="aboutimg"><?php echo get_the_post_thumbnail($queried_post->ID, '') ?></div>
    <div class="about">
    <?php echo $queried_post->post_content; ?>
    </div>

    This work excepts it seems to strip out all my <p> tags. So if I have two paragraphs on the page, it merges it into one.

    Any suggestions?
    Many thanks!
    Matt

  2. mattblank
    Member
    Posted 1 year ago #

    Can anyone help me with this please?

  3. alchymyth
    Forum Moderator
    Posted 1 year ago #

    try

    <?php echo apply_filters( 'the_content', $queried_post->post_content ); ?>
  4. mattblank
    Member
    Posted 1 year ago #

    Excellent! Works a charm.

    Thank you so much :)

    Matt

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.