2

I'm using code to change Rss Feed Link for my wordpress site, it's working but I don't know how to add more than one rss link appear when someone click on browser Rss Icon, I need these links to appear for all pages below each other for categories "products", "blog" and "news".

here is the code which I'm using to change my rss link

add_filter('feed_link','custom_feed_link', 1, 2);

function custom_feed_link($output, $feed) {

    $feed_url = 'http://MYSITE/category/products/feed';

    $feed_array = array('rss' => $feed_url, 'rss2' => $feed_url, 'atom' => $feed_url, 'rdf' => $feed_url, 'comments_rss2' => '');
    $feed_array[$feed] = $feed_url;
    $output = $feed_array[$feed];

    return $output;
}

I tried to return array, but it can't work, what I should do ?

enter image description here

  • what I need is to append selected categories feed link to appear when a user click on browser rss icon, same as attached image, so they can subscribe to any category feed which they prefer – usama sulaiman Feb 1 '15 at 10:32
  • I might have found solution to your problem, please check my updated answer. – IlmarsL Feb 11 '15 at 12:00
0

Text that is displayed after you click on browser RSS icon depends on the feed reader you are using. I don't think you can modify what it displays directly through WordPress (correct me if I'm wrong).

A simple workaround to achieve something similar to what you want would be placing feed links to different categories. You can place a link for every category somewhere on the page using get_category_feed_link() function.

Edit:

Some feed readers (Chrome's RSS feed Reader) get feeds from sites header. In this case you can get them to display feed by adding link directly to header.php inside the <head>. Link could be formatted something like this:

<link rel="alternate" type="application/rss+xml" title="Category1 feed" href="<?php echo get_category_feed_link( get_cat_ID( 'category1' ) ); ?>" /> 
  • @ IlmarsL Thank you for your reply I'm using similar method <?php wp_list_categories('feed_image=http://SITE_URL/image.gif&feed=XML Feed&optioncount=1&children=0'); ?> but my What I need is to append selected categories feed link to appear when a user click on browser rss icon, same as when you navigate to a post, you will find that its feed link's appended to site feed link, that's what I'm looking for – usama sulaiman Feb 2 '15 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.