Skip to main content
Added call to wp_reset_postdata() to reset post data after loop
Source Link
Stephen Harris
  • 32.6k
  • 6
  • 84
  • 118

(get_)the_excerpt() strips HTML tags - that's why you don't have HTML tags. ;)

Just use the_content() instead of the_excerpt() if you want to show the full content.

$recent = new WP_Query("page_id=2");
while ($recent->have_posts()) : $recent->the_post();
    echo '<a href="'.get_the_permalink().'" rel="bookmark">Permalink</a>';
    the_content();
endwhile;
wp_reset_postdata();

As for the best way of outputting post data, you should have a look at this.

(get_)the_excerpt() strips HTML tags - that's why you don't have HTML tags. ;)

Just use the_content() instead of the_excerpt() if you want to show the full content.

$recent = new WP_Query("page_id=2");
while ($recent->have_posts()) : $recent->the_post();
    echo '<a href="'.get_the_permalink().'" rel="bookmark">Permalink</a>';
    the_content();
endwhile;

As for the best way of outputting post data, you should have a look at this.

(get_)the_excerpt() strips HTML tags - that's why you don't have HTML tags. ;)

Just use the_content() instead of the_excerpt() if you want to show the full content.

$recent = new WP_Query("page_id=2");
while ($recent->have_posts()) : $recent->the_post();
    echo '<a href="'.get_the_permalink().'" rel="bookmark">Permalink</a>';
    the_content();
endwhile;
wp_reset_postdata();

As for the best way of outputting post data, you should have a look at this.

Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

(get_)the_excerpt() strips HTML tags - that's why you don't have HTML tags. ;)

Just use the_content() instead of the_excerpt() if you want to show the full content.

$recent = new WP_Query("page_id=2");
while ($recent->have_posts()) : $recent->the_post();
    echo '<a href="'.get_the_permalink().'" rel="bookmark">Permalink</a>';
    the_content();
endwhile;

As for the best way of outputting post data, you should have a look at this.