WordPress.org

Forums

Nice name for Feed for all categories except one? (5 posts)

  1. BinaryMoon
    Member
    Posted 10 years ago #

    Hi

    I've split my blog in two. I now have a small link blog which is basically a category that lists things I find interesting, and a normal blog which has everything else in it.

    I worked out that I can have the feed for just the link category using

    http://www.binarymoon.co.uk/category/links/feed

    But I now want to have a feed for all the other categories. This works (http://www.binarymoon.co.uk/wp-rss.php?cat=-4) but isn't good for permalinkiness (is that a real word? I'm thinking no)

    So, any ideas how I can change the link above so that it looks nice and pretty like my othr feed links?

  2. Kafkaesqui

    Posted 10 years ago #

    In each file for the feeds you're supporting (wp-rss.php, wp-rss2.php, wp-rdf-php and wp-atom.php), locate at the top where wp-blog-header.php is included:

    require('wp-blog-header.php');

    Right before that line, insert these two:

    if(!(isset($_GET['category_name'])) && ('links' == $_GET['category_name']))
    $cat=-4;

    This will allow you to use your syndication urls as you normally do, but exclude the "link" category from the feed unless specifically linked to.

  3. BinaryMoon
    Member
    Posted 10 years ago #

    So doing that I can use the link mentioned above?

    That's cool. I'm not keen on modifying the source code (not because i can't but because it makes upgrading awkward). I think I am going to see if a plugin is possible before I do this. I was intending to have a go at writing plugins anyway so this could be interesting :)

    Actually reading through that again the category will never be set to -4. You're checking that the category isn't set and the links = the category name. Neither will be true at the same time though...?

  4. Kafkaesqui

    Posted 10 years ago #

    The logic of the code (if I had written it down correctly the first time; the line above will probably cause an error):

    If the following is *not* true: 'category_name' is a query and 'links' is the value of category_name -> make $cat equal -4. So if there's no category_name query, or if there is but it equals something other than 'links', the statement will be true.

    Here's a corrected version of my hasty coding above:

    if(!(isset($_GET['category_name']) && 'links' == isset($_GET['category_name'])))

  5. BinaryMoon
    Member
    Posted 10 years ago #

    Ah - That makes more sense.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.