How to build your own RSS feed in a seperate page of your WordPress.org blog

Hopefully my experience will help the next poor soul who’s trying to be a bit different in how their blog is set up.

I will state in advance that I have NO IDEA if this will work in a WordPress.com hosted blog, I suspect not, but I don’t know. If someone tries it please let me know the results. I no longer have a blog on that side to play with (I deleted it when I realized I wasn’t going to use it) and don’t feel like creating one just to play around with. If that changes I’ll let you know.

One more warning.  DO NOT USE THE PUBLISH BUTTON UNTIL YOU ARE DONE AND HAVE NO MORE CHANGES TO MAKE AND HAVE SAVED A COPY OF YOUR CODE TO YOUR COMPUTER.  If you neglect my warning its not my fault if it all goes kablooey.  Use the Preview button instead.  TRUST ME.

Ok, the first thing you need to do is go find a plugin called PHP Execution. If you don’t know how to find and install new plugin’s on your blog figure that out first before hitting here. As of the time of this posting the plugin hadn’t been tested with the current WordPress version (3.3.1), but it appears to be working fine. The couple glitches I hit along the way I’m pretty sure are WordPress’s fault and not the plugin. I tried a couple other PHP plugins and none of them seemed to work as well as this one. Didn’t try them all so if you want to suggest something else let me know.

Next thing to do, load up Notepad, Word, Dreamweaver, SOMETHING you can do the actual typing of the code into and save onto your computer from. Why? Well, it turns out that after you get the page up and running, and then realize you need to add a blog to the list and you go into the edit page setup, well, WordPress promptly does funky things to the coding that result in breaking the page. So, everytime you need to edit the page you’ll need to do so on the file on your computer FIRST, then copy and paste the whole file into the page, overwriting what was there. (Yes, this was “fun” to figure out. )

3rd thing to do: put together a list of the blogs you want on your feed (or other sites or what have you) and figure out the actual URL of the FEED (this is not the same as the main page of the blog). For most Blogger and WordPress (both .com and .org) blogs its pretty straight forward to find. Figure out one and the rest of the same type of blog are the same, just change out the blog names. But there are some random ones floating around, so check and make sure you KNOW what the URL is. Either open up a bunch of tabs on your browser, or type a list, I don’t care.

4th thing: Create a new page on your blog. Title it however you feel like, mine’s “RSS Feed”. In the body of the page, click the tab that says HTML so that you’re creating the page in code not text, yes, this does make a difference, trust me.

Once you’ve done the above you’re ready for actual code.  Copy and paste this:

<?php
include_once(ABSPATH.WPINC.’/rss.php’);
$feed = fetch_rss(‘http://ambulancedriverfiles.com/feed/’);
$items = array_slice($feed->items, 0, 1);
?>
<?php if (!empty($items)) : ?>
<?php foreach ($items as $item) : ?>
<h2><a href=”http://ambulancedriverfiles.com”>Ambulance Driver</a></h2>
<ul><li><h2><a title=”php” href=”&lt;img src=”><?php echo $item[‘title’]; ?></a></h2></li></ul>
<?php endforeach; ?>
<?php endif; ?>

 into the body of the page.  

3rd line from the top, see where the link for Ambulance Driver’s feed is?  Replace that link with the link to the feed of your choice (Ambulance Driver got picked at random, no special meaning, I promise), DO NOT screw up any of the ‘ or other such on the ends.  Just replace the URL.  If you mess up something else it won’t work.

Next line down (4th line from the top), see: 

items, 0, 1

?  That 2nd number tells it how many posts you want to have listed.  I only want to have listed the most recent one, so I put 1 in the 2nd spot.  But you can change that to any number you like.  Note, if you put 0 you won’t see anything but the title of the blog.

Ok, 4th line FROM THE BOTTOM (note, if your screen is small it may cause the text to wrap weird resulting in this being the 5th line from the bottom) is the line that starts:

<h2><a href=”http://ambulancedriverfiles.com”>Ambulance Driver</a>

Replace Ambulance Driver’s URL with the home page URL of the blog, and replace the “Ambulance Driver” with the name you want the blog listed under on the Feed.

Repeat the above steps for every blog on your list.  I put mine in alphabetical order by Title, but you can order (or not order them) them however you feel like. 

Please note, this format as listed above does NOT change the font size, on my blog it defaulted to a HUGE font size which I went nuts trying to change.  If you want to change the font size you’ll need to add two lines of code.  In the very first blog’s code, create a blank line right above the line where you put in the blog’s title (the 4th from the bottom line mentioned above), please do NOT delete any code to create the blank line, just hit enter ok?  In the new blank line enter the code:

<font size=1;>  

The number corresponds to the font size, change it and see what happens to decide which font size you want (DO NOT USE THE PUBLISH BUTTON TO DO THIS, use the preview button, if you use Publish I’m not responsible if it all goes kablooey).  The 2nd line of code you need to add, scroll all the way to the bottom of your page to the very LAST blog’s code, and above the line two lines from the bottom create a blank line and enter the code:

</font>

The font type and color should be the defaults for your blog.  If you want them to be different I’ve not bothered to figure that out yet so to bad.

Now, this code originally had code to add a brief bit of the first line or so of each post in there too, I deleted that because it didn’t work on all the blogs and having it on only some annoyed me.  If you really want it you’re going to create a blank line above two lines from the bottom of the code (for EACH blog’s code) and enter in:

<p><?php echo $item[‘description’]; ?></p>

Note, for the last blog in line the above line should go ABOVE the font code.

Once you’re done, BEFORE you hit the “Publish” button (yes, before, if you wait till after it might all go kablooey, trust me) copy and paste the WHOLE thing into your Notepad, Word, whatever you’re using to save it.  Note, now that you’ve taken this step it probably won’t go kablooey on you, but its worth it, trust me.

Ok, NOW you can hit publish.  Go look at your new page, isn’t it shiny?  If its not shiny and something’s not working you probably deleted a ‘ by accident.  Go look it over very carefully.  Enjoy!

 

If there’s someone reading this who knows PHP, the only thing left that I’d like to add is to have each post title come with the date/time stamp of when they were posted.  If someone could help me out (I’ll eventually figure it out on my own, but until then…..)