View Full Version : Displaying RSS Feed on website

04-16-2012, 09:20 PM
i would like to have my Wordpress blog posts shown on my homepage whenever they are posted.

I've seen a number of tutorials showing how to do it, however, they all just show how to display a short description of the post. is there a way i can display only a certain amount of characters or words of the latest post, other than the usual 255 or so that most of them default to?

04-17-2012, 02:11 AM
here's a way of showing a limited niumber of characters but also only showing whole words.

$text=$row['text'] ;
$position=130; // Define how many characters you want to display.

$post = substr($text,$position,1); // Find what is the last character displaying. We find it by getting only last one character from your display message.

if($post !=" "){ // In this step, if last character is not " "(space) do this step .

// Find until we found that last character is " "(space)
// by $position+1 (14+1=15, 15+1=16 until we found " "(space) that mean character 20)
while($post !=" "){

$post = substr($text,$position,1);


$post = substr($text,0,$position); // Display your message ?>

so echo out $post in this example

04-17-2012, 10:14 PM
how would i implement that into showing my Wordpress RSS feed?

thank you for your help! I'm not very fluent in my PHP or how to use it fully.

the code I'm using is

// Include the file that does all the work

// This is the URL to the actual RSS feed. Change this value
// if you want to show a different feed.

// Create an instance of the rssFeed object, passing it
// the URL of the feed
$rss=new rssFeed($url);

// If there was an error getting the data
// Show the error
print "<h1>Error:</h1>\n<p><strong>$rss->error</strong></p>";

// Otherwise, we have the data, so we call the parse method

// Show the news stories

04-18-2012, 03:01 AM
// Include the file that does all the work

says it really, you would have to write a new method for this file or extend the existing showStories() i would say