Archives by Month

Support this Site!

You may have noticed that there's very little third-party advertising on this site. I'd like to keep it that way. Here's how you can help:

  • Buy my books. They're available at great prices on Amazon.com.
  • Check out my training videos on Lynda.com. It's a great source for "all you can eat" training.
  • Donate a few dollars. It'll help cover my hosting costs and give you a chance to tell me what you want to see covered here.
  • Comment on blog posts. You can help get a discussion going that can benefit others, making the site more valuable for everyone.

How to Create a WordPress RSS Feed Page

A how-to piece that goes beyond the scope of our upcoming WordPress book.

WordPress User Level: Intermediate to Advanced

WordPress has a powerful and flexible Pages feature that enables you to create Web pages that are part of your blog yet exist outside the blog chronology. You can find examples of the Pages feature on this site by clicking the links at the very top of the page; all of them except FAQ point to WordPress Pages on this site.

Note that I’m using an uppercase P when discussing this Pages feature. That’s so you don’t get confused between the generic use of page (as in Web page) and WordPress Page feature Page.

This site has a bunch of categories that can be broken down into two groups: book support categories and Maria’s WebLog categories. You can see them listed in their groups in the sidebar, with a bunch of links between them.

Although I’d like to believe that Maria’s WebLog is so incredibly fascinating that most people come here just to read it, I know that’s not true. Many people come here to get additional information and support for my books. There are a bunch of these books (61 or 62 at last count) and a handful still in print at any time. This site’s Book Support categories provide support for those books.

Why Bother with a Custom Page?

On my old support site (www.langerbooks.com), each book had its own RSS feed. I didn’t realize it until recently, but many readers were using that feed to keep apprised of new content via RSS feed reader software. As I have stated elsewhere, although I know what a newsreader is for, I don’t personally use one on a regular basis. So it wasn’t until I realized that people were looking for those old feeds that I decided to provide new feeds to replace them.

There was an easy way to do this: simply include the feed=RSS parameter in the wp_list_cats template tag I use in the sidebar. So, for example, my current use of this tag:

<?php wp_list_cats('sort_column=name'); ?>

would be changed to:

<?php wp_list_cats('sort_column=name&feed=RSS'); ?>

If you’ve got sharp eyes and know WordPress, you may realize that something’s missing from that tag: the exclude parameter that enables me to break your category list into two groups without using parent and child categories. I’ll cover that in a future article.

Using that second bit of code would display (RSS) after each category name in the sidebar. RSS would be a link to the RSS feed for that category.

The trouble is, I didn’t like the way it looked. After all, who really wants to see (RSS) after every single category name in the list? It looks goofy. I didn’t like it, so I didn’t want to do it that way.

Instead, I decided to tap into the Pages feature and create my own custom Page template for listing RSS feeds.

Creating the File

To do this, start with one of the existing Pages templates. The one I picked was archives.php, which can be found with your other theme files in its theme folder.

If your theme does not include archives.php (not to be confused with archive.php), you’ll have a bit more work to do. You’ll have to get the archives.php file from the Default theme and the index.php file from your chosen theme and create a sort of hybrid with header information from archives.php inserted in index.php that has The Loop removed. If you know what I’m talking about, go for it. If you don’t, stop reading and wait for a future article about creating a Pages template when one doesn’t exist for your theme. (You may have to wait a while; comments requesting such an article might help push me to write it.)

Now with the achives.php file open in your favorite text editor (hopefully something that’s a real text editor and not a word processor), start by saving the file with the name rssfeeds.php (or something like that) in your theme’s folder — that’s the folder where your other theme files reside. Now edit the contents of the file as follows:

  1. Replace Template Name: Archives with Template Name: RSS Feeds
  2. Delete everything that’s in the “content” of the page. In my theme, for example, that’s everything between <div id="content"> and </div>, not including those two lines.
  3. Insert (where the lines were deleted) the codes to display the category names with the links. That can be something as simple as what’s noted above: <?php wp_list_cats('sort_column=name&feed=RSS'); ?>. Or it can be kinda fancy, like what I’ve got in my version of the file:

    <h1>RSS Feed Links</h1>
    
    <p>Click the icon or use the RSS link to subscribe to an RSS feed for the entire site or a specific site topic.</p>
    
    <h2>Entire Site</h2>
    
    <ul>
    
    <li><a href="http://feeds.feedburner.com/marialanger" title="Subscribe to Maria's WebLog" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="border:0"/></a></li>
    
    <li><a href="http://add.my.yahoo.com/rss?url=http://feeds.feedburner.com/marialanger" title="Maria's WebLog"><img src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif" alt="" style="border:0"/></a></li>
    
    <li><a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=
    
    http://feeds.feedburner.com/marialanger" title="Maria's WebLog"><img src="http://www.newsgator.com/images/ngsub1.gif" alt="Subscribe in NewsGator Online" style="border:0"/></a></li>
    
    <li><a href="http://fusion.google.com/add?feedurl=http://feeds.feedburner.com/marialanger">
    
    <img src="http://buttons.googlesyndication.com/fusion/add.gif" width="104" height="17" style="border:0" title="Maria's WebLog" alt="Add to Google"/></a></li>
    
    <li><a href="http://www.bloglines.com/sub/http://feeds.feedburner.com/marialanger" title="Maria's WebLog" type="application/rss+xml"><img src="http://www.bloglines.com/images/sub_modern1.gif" alt="Subscribe in Bloglines" style="border:0"/></a></li>
    
    <li><a href="http://feeds.my.aol.com/add.jsp?url=http://feeds.feedburner.com/marialanger">
    
    <img src="http://myfeeds.aolcdn.com/vis/myaol_cta1.gif" title="Maria's WebLog" alt="Add to My AOL" style="border:0"/></a></li>
    
    </ul>
    
    <table width="100%">
    
    <tr>
    
    <td width="50%" valign="top">
    
    <!-- BLOG CATEGORIES -->
    
    <h2>Maria's WebLog</h2>
    
    <ul>  <li class="cat-item cat-item-3"><a href="http://www.mariasguides.com/category/book-support/" title="Topics I&#039;m currently producing content about.">Current Topics</a> (<a href="http://www.mariasguides.com/category/book-support/feed/" title="RSS">RSS</a>)
    <ul class='children'>
      <li class="cat-item cat-item-4"><a href="http://www.mariasguides.com/category/book-support/excel-books/" title="Support for my Excel books and other training material.">Excel</a> (<a href="http://www.mariasguides.com/category/book-support/excel-books/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-37"><a href="http://www.mariasguides.com/category/book-support/facebook/" title="View all posts filed under Facebook">Facebook</a> (<a href="http://www.mariasguides.com/category/book-support/facebook/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-5"><a href="http://www.mariasguides.com/category/book-support/ipad-book-support/" title="How to information about iPad.">iPad</a> (<a href="http://www.mariasguides.com/category/book-support/ipad-book-support/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-113"><a href="http://www.mariasguides.com/category/book-support/mac-os/" title="Support for my Mac OS books and other training material">Mac OS</a> (<a href="http://www.mariasguides.com/category/book-support/mac-os/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-11"><a href="http://www.mariasguides.com/category/book-support/twitter/" title="Support for my Twitter training materials.">Twitter</a> (<a href="http://www.mariasguides.com/category/book-support/twitter/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-12"><a href="http://www.mariasguides.com/category/book-support/word-books/" title="Support for my Word books and other training material.">Word</a> (<a href="http://www.mariasguides.com/category/book-support/word-books/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-13"><a href="http://www.mariasguides.com/category/book-support/wordpress-books/" title="Support for my WordPress books and videos.">WordPress</a> (<a href="http://www.mariasguides.com/category/book-support/wordpress-books/feed/" title="RSS">RSS</a>)
    </li>
    </ul>
    </li>
      <li class="cat-item cat-item-7"><a href="http://www.mariasguides.com/category/other/" title="Other content on this site.">Other Content</a> (<a href="http://www.mariasguides.com/category/other/feed/" title="RSS">RSS</a>)
    <ul class='children'>
      <li class="cat-item cat-item-116"><a href="http://www.mariasguides.com/category/other/deals-and-steals/" title="Special offers and other deals that can save you money.">Deals and Steals</a> (<a href="http://www.mariasguides.com/category/other/deals-and-steals/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-15"><a href="http://www.mariasguides.com/category/other/downloads/" title="Downloadable files, including sample files and excerpts.">Downloads</a> (<a href="http://www.mariasguides.com/category/other/downloads/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-16"><a href="http://www.mariasguides.com/category/other/links-worth-following/" title="Miscellaneous links of interest.">Links Worth Following</a> (<a href="http://www.mariasguides.com/category/other/links-worth-following/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-114"><a href="http://www.mariasguides.com/category/other/out-of-print-books/" title="Content related to out-of-print books and other training materials.">Out-of-Print Books</a> (<a href="http://www.mariasguides.com/category/other/out-of-print-books/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-9"><a href="http://www.mariasguides.com/category/other/screencasts/" title="Video screencasts of how-to information.">Screencasts</a> (<a href="http://www.mariasguides.com/category/other/screencasts/feed/" title="RSS">RSS</a>)
    </li>
      <li class="cat-item cat-item-118"><a href="http://www.mariasguides.com/category/other/site-info/" title="Information about the operation of this site, including site news and other changes.">Site Information</a> (<a href="http://www.mariasguides.com/category/other/site-info/feed/" title="RSS">RSS</a>)
    </li>
    </ul>
    </li>
    </ul>
    
    </td>
    
    <td width="50%" valign="top">
    
    <!-- BOOK SUPPORT CATEGORIES -->
    
    <h2>Book Support</h2>
    
    <ul><li>No categories</li></ul>
    
    </td>
    
    </tr>
    
    </table>

  4. Save the file’s changes.

Creating the Page

Once the file has been created and saved to the appropriate folder in your themes folder, you’re all ready to use it.

  1. Log into your WordPress blog and use the navigation at the top of the page to get to the Write Pages administration panel.
  2. In the right column, choose RSS Feeds from the Page Template drop-down list.
  3. Click Publish beneath the Page Content box.

Sure, you can enter a page title and content in the boxes. But they’ll be completely ignored so you’ll be wasting your time. Only the tags you included in the template will appear in the page.

Using the Page

The last step is to link the page to your site. If you already use the get_links or wp_get_links tag in your sidebar, you’re done; the page will appear with the other pages that are listed. But if you don’t (I don’t) you’ll have to modify the sidebar.php or, in my case, the header.php file to add the link. I call the link RSS and you can see it at the top of every page.

That’s All There Is To It

Of course, if you’re like me you won’t be happy with the first version of the Page. But fixing it is easy. Just use your text editor to modify the rssfeeds.php file you created. You can reload the Page on your blog to see the results of your changes. No need to edit the Page. After all, there’s nothing in the Page, is there?

What do you think of all this? Use the Comments link to let me know. You can also use the Comments link for this post to submit questions about it; please don’t ask questions about topics not covered in this article.

For more great information about going beyond the basics with WordPress, be sure to visit the WordPress Codex and the WordPress Support Forums.

7 comments to How to Create a WordPress RSS Feed Page

  • Sam

    Why do you have to create a new template? Why can’t you just put the codex calls in a WordPress page created using the default Page template?

  • imp

    is there any code to read the wordpress rss on a normal site? i want to put my blog update on other website index.

  • Stef

    My websites theme doesn’t have an achives.php. If you could give me some hints to get this done, I would highly appreciate it.

    I’ve put the content of the default theme achives.php in the index.php of my websites theme. The Page Template drop-down list is showing the RSS Feeds link. But nothing is shown in the Page itself.

    Any ideas?

  • Stef: You need to replace the contents of any PAGE template — not POST template — with what’s here. And frankly, I’m not sure if these instructions even work anymore. They were written nearly 3 years ago, probably for WordPress 2.0 or 2.1.

  • Dmytro

    Perhaps you could write an updated article then? It would be a lot of help. You’ve also mentioned that archives.php shouldn’t be confused with archive.php – can you explain the difference? Are both a requirement for a theme to work correctly?

    I’m also puzzled as to why one can’t simply create a page from a blank template (or from no template) and just make links? Do you understand what I’m trying to say?

    Having a php template for a page, in my opinion, is only useful when you have dynamic content that changes often: for example, you could use php to list your categories and have the first five recent posts from each of them appear in your Achives page.

    But when you just have a simple RSS feed links, couldn’t you just make normal links in a page? Unless you add a new category every day, you wouldn’t need to rely on php to generate a list of category links and you could just manually insert them.

    It sounds so much more simpler, not to mention people who don’t have as much experience in php could format it into columns, sections, and whatnot much more easily.

    Your thoughts?

    • Dmytro: Unfortunately, I’m under contract to create some video training material right now. I don’t have the time to research and write complex content for this site. I need to work on the projects that help me earn a living. Since this site does not produce any revenue, adding new content is extremely low on my priority list.

      Understand that the article you are commenting on offers ONE WAY to create a RSS feed page. It was the way I used back in 2006 when I wrote about it. I don’t have an RSS feed page anymore. There must be hundreds of ways to create one. Surely you can give this some thought and come up with your own unique way to get the job done.

  • [...] these pages as feeds from the blog categories. I’m not sure if it’s possible, but this article might be a good starting point to find out if it is). I also updated the CV/About section. Stem på [...]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>