Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #880768
    turnkeydigital
    Participant

    I am showing the latest two posts on the homepage and I grabbed code to show the excerpt but wanted to change it to using the_content. When doing that the content displays outside of the post above where it should be.

    $output .= '<article id="post-' . get_the_ID() . '" class="' . implode( ' ', get_post_class() ) . '">'
                       . '<div class="entry-wrap">'
                         . $image_output
                         . '<div class="x-recent-posts-content">'
                           . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>'
                           . '<span class="x-recent-posts-date">' . get_the_date() . '</span>'
                           . '<span class="x-recent-posts-content">' . the_content() . '</span>'
                           . '<a class="x-btn x-btn-transparent x-btn-square x-btn-regular t' . $count . ' ' . $image_output_class . '" href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ) . '">'
                           . 'Read More' . '</a>'
                         . '</div>'
                       . '</div>'
                     . '</article>';
    #881459
    Paul R
    Moderator

    Hi,

    Thanks for writing in!

    Please replace the_content() with get_the_content()

    Hope that helps.

    #882206
    turnkeydigital
    Participant

    Thanks that worked.

    #883158
    Friech
    Moderator

    We’re delighted to assist you with this.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-880768 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>