Title: Substr function
Last modified: August 19, 2016

---

# Substr function

 *  [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/)
 * Hi,
 * I fancy getting a snippet of 90 characters from the most recent news item and
   displaying it on my home page.
 * Can someone show me the way to do this in WP?
 * Many thanks!

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

 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759261)
 * You can use [multiple loops](http://codex.wordpress.org/The_Loop#Multiple_Loops).
 * Something like:
 *     ```
       <?php query_posts('showposts=1'); ?>
   
        <?php while (have_posts()) : the_post(); ?>
           the_excerpt();
        <?php endwhile;?>
       ```
   
 *  Thread Starter [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759263)
 * And would this keep it to roughly 90 characters?
 * Or would it be like the_excerpt(90) ??
 *  [ivovic](https://wordpress.org/support/users/ivovic/)
 * (@ivovic)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759268)
 * The function you want is [the_content_rss()](http://codex.wordpress.org/Template_Tags/the_content_rss).
   It lets you specify a character limit.
 *  Thread Starter [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759270)
 * Brilliant, thanks again Ivovic, comin to the rescue 😀
 *  [ivovic](https://wordpress.org/support/users/ivovic/)
 * (@ivovic)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759271)
 * I knew there had to be a reason I wore my underwear on the outside 😉
 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759272)
 * LOL
 *  Thread Starter [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759274)
 * Hehehe, plus the brass band starting up just as you flew by was a dead give away!
   🙂
 * OK, RSS Feed is working great, but when I try this in my index.php page it doesn’t
   work
 * `<?php the_content_rss('', TRUE, '', 90); ?>`
 * Any ideas?
 *  [ivovic](https://wordpress.org/support/users/ivovic/)
 * (@ivovic)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759275)
 * yeah, you need to put it into a loop, as described by wp_guy above…
 * take what he gave you, and just substitute the rss line, where he puts the_excerpt
 * we’re actually more of a dynamic duo.
 *  Thread Starter [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759284)
 * Hehe and I’m the damsel in distress. But wearing Bapesta’s and my arms don’t “
   flail” nearly as much 😀
 * Have you got a name yet?
 * Oh and almost there: `<?php query_posts('showposts=1'); ?><?php while (have_posts()):
   the_post(); ?><?php the_content_rss('', TRUE, '', 90); ?><?php endwhile;?>` except
   it displays the full post and doesn’t chop up the string at 90 characters 🙁 
   Any takers?
 *  [ivovic](https://wordpress.org/support/users/ivovic/)
 * (@ivovic)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759286)
 * ahh, that’s my mistake actually… the_content_rss limits the number of WORDS not
   the number of CHARACTERS… oops.
 * I guess that’s better actually but you might want to lower the number dramatically
   for desired effect.
 * sorry about your kitty m’am, sometimes I don’t know my own strength 😛
 * as for a name, I think given mistakes like this, it’s better we remain mysterious
   than to risk getting sued.
 *  Thread Starter [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759288)
 * Hahaha 😀
 * Here have a nickel.
 * Watch out! Here comes Marvel, they wanna make a movie. Run!
 *  [ivovic](https://wordpress.org/support/users/ivovic/)
 * (@ivovic)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759289)
 * *makes a wooshing sound and leaves wp_guy to smile for the cameras*
 *  Thread Starter [michaelmcguk](https://wordpress.org/support/users/michaelmcguk/)
 * (@michaelmcguk)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759326)
 * 🙂
 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759346)
 * :^)

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

The topic ‘Substr function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 3 participants
 * Last reply from: [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/substr-function/#post-759346)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
