WordPress.org

Ready to get started?Download WordPress

Forums

New stuff: Caegory feed links for wp_list_cats() (14 posts)

  1. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    wp_list_cats now accepts two new arguments: feed and feed_image. If either are set, a feed link is provided for each category in the list. feed_image is the url to the image you want to use as a link button. feed is the text you want to use for the link. If both are set, feed is used as the alt text for feed image. Examples:
    Provide feed links with 'XML' as the link text:
    wp_list_cats('feed=XML');
    Provide feed links using xml.png as the link image:
    wp_list_cats('feed_image=/wordpress/images/xml.png');
    Provide feed links with xml.png as the image and 'XML' as the alt text:
    wp_list_cats('feed=XML&feed_image=/wordpress/images/xml.png');
    If you use permalinks, the feed links use pretty URLs. For example, /archives/author/ryan/feed/.
    Ryan

  2. Gordon
    Member
    Posted 10 years ago #

    Many tnx for this.
    I think you know why.... ;)

  3. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    Yes, indeed. ;-)

  4. phpNeophyte
    Member
    Posted 10 years ago #

    Can you put a link to see an example of this being used so I can see what the visual result is? Thanks.
    Kevin

  5. Kerim
    Member
    Posted 10 years ago #

    Yes, please, how does this work? How do I create an rss feed that is only for a given category?

  6. Kerim
    Member
    Posted 10 years ago #

    Figured it out. Just like this:
    .../wp-rss2.php?cat=1

  7. CoffeeSwirls
    Member
    Posted 10 years ago #

    Can we get a little more descriptive? I've been trying to impliment this, but haven't had any luck.

  8. Kerim
    Member
    Posted 10 years ago #

    Look at the URL of your RSS2 feed. (Copy it from the front page of your blog by cntl-click and choose "copy URL to clipboard".) It should look something like this:
    http://www.yourwebsite.com/wp-rss2.php
    Then, simply add the tag: "?cat=#" where # is the number of the category you want to have in your feed.
    If you don't have URL redirection on, you will see this number when you try to look at your category archives. If it is on, you might be able to find it in the admin panel where you edit categories. The RSS feed will look like this:
    http://www.yourwebsite.com/wp-rss2.php?cat=1
    Does that help? (I'm using WP 1.2, I don't know about other versions.)

  9. Ryan Boren
    WordPress Dev
    Posted 10 years ago #

    Or, if you're using permalinks, just append "feed/" to your category links. For example:
    http://www.yourwebsite.com/archives/category/general/feed/

  10. CoffeeSwirls
    Member
    Posted 10 years ago #

    Oh... That was almost too easy!
    My thanks!

  11. Anonymous
    Unregistered
    Posted 10 years ago #

    Any way save editing the code base (variable, etc...) to have the xml feed links appear BEFORE the category name instead of after?
    If I have to go in and tweak the code I will, but I'd rather use a variable to the function if one exists so when I upgrade I won't have to re-tweak again.

  12. Anonymous
    Unregistered
    Posted 10 years ago #

    So I finally found the function and took a peek. Doesn't look like there's an option, so I just tweaked teh code and moved that lump up ahead of the link creation for the title. Might be nice to add this in though, as the UI looks SO much better with graphics in front of category titles of differing lengths see:
    http://www.blueneedle.com/wordpress/
    Heck, maybe even make them in front by default...??

  13. _mf_
    Member
    Posted 10 years ago #

    I wanted my XML links to be only text, enclosed in square brackets. Unfortunately the text links are hardcoded as parenthesis so I was getting ([XML)].
    In file template-functions-category.php, change lines 355 and 378 so the link .= ")"; doesnt have the parenthesis anymore.

  14. klintron
    Member
    Posted 9 years ago #

    I'm having trouble with this... I'm using wordpress 1.2 with the Kubrick template. There's a bunch of arguments in my list categories thing:
    Looks like this:
    php list_cats( 1, 'All Categories', 'name', 'asc', 'archivespage.php', 1, 0, 1, 1, 1, 0, 0,'','','','','28')
    Adding the feed=xml argument causes it to screw up unless I put it at the very end, after the 28. Then instead of screwing up, it just doesn't do anything.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags