+<?php if ( is_singular() ) { ?>
+ <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
+ <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" />
+ <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id>
+<?php } elseif(is_search()) { ?>
+ <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
+ <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
+ <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
+<?php } else { ?>
+ <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />