Title: Recent post pull code doesn&#8217;t bring formatting&#8230;
Last modified: August 19, 2016

---

# Recent post pull code doesn’t bring formatting…

 *  [working-together](https://wordpress.org/support/users/working-together/)
 * (@working-together)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/recent-post-pull-code-doesnt-bring-formatting/)
 * Hi, I am using the below code to pull the excerpt of the most recent post in 
   my News category into a column on my front page. It does that, but I noticed 
   in the “excerpt” part it doesn’t pull in the formatting. For example if there
   were two short paragraphs, it will lump all the text into 1 paragraph. Also, 
   if the was a hyperlink, it won’t pull that over, it will just look like plain
   text.
 * Can someone please point me in the right direction to where I can learn how to
   make this work. Thanks.
 *     ```
       <?php if(have_posts()) : ?>
                  <?php query_posts('category_name=News&showposts=1'); ?>
                   <?php while(have_posts()) : the_post(); ?>
              <h3><?php the_title(); ?></h3>
       <?php the_excerpt(); ?>
       <a href="<?php the_permalink(); ?>" title="Read the rest of <?php the_title(); ?>" class="permalink">Learn More ></a>
        <?php endwhile; ?>
                   <?php endif; ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/recent-post-pull-code-doesnt-bring-formatting/#post-1451522)
 * > Can someone please point me in the right direction to where I can learn how
   > to make this work.
 * ‘the_exerpt()’ strips **all **html from the content;
    it sounds as if you want
   to keep certain formatting, but don’t want to have images, captions, etc in your
   excerpt:
 * i think this needs a few steps of string manipulation – useful links:
 * get_the_content();
    [http://codex.wordpress.org/Function_Reference/get_the_content](http://codex.wordpress.org/Function_Reference/get_the_content)
 * strip_shortcodes();
    [http://codex.wordpress.org/Function_Reference/strip_shortcodes](http://codex.wordpress.org/Function_Reference/strip_shortcodes)
 * strip_tags();
    [http://www.w3schools.com/php/func_string_strip_tags.asp](http://www.w3schools.com/php/func_string_strip_tags.asp)
 * substr()
    [http://www.w3schools.com/php/func_string_substr.asp](http://www.w3schools.com/php/func_string_substr.asp)
 * allpy_filters(‘the_content’,$string)
    [http://codex.wordpress.org/Function_Reference/apply_filters](http://codex.wordpress.org/Function_Reference/apply_filters)
 *  Thread Starter [working-together](https://wordpress.org/support/users/working-together/)
 * (@working-together)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/recent-post-pull-code-doesnt-bring-formatting/#post-1451606)
 * Good to know about ‘the_exerpt()’ .
 * I’ll start working through the links.
 * Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Recent post pull code doesn’t bring formatting…’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [working-together](https://wordpress.org/support/users/working-together/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/recent-post-pull-code-doesnt-bring-formatting/#post-1451606)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
