Word Press - Comments RSS. How do you remove the link?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

We have a blog where we don't allow comments or discussion - just our posts.
But we are unable to find how to remove the "Comments RSS" link, even tho our sitemap is finding it as it is there. But a dead link.

It's on the left under META. How do you remove that simple hyperlink?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press - Comments RSS. How do you remove the link?

Post by Celauran »

Where it is will depend on your theme, but look for

Code: Select all

<?php bloginfo('comments_rss2_url'); ?>
and remove it.

http://codex.wordpress.org/WordPress_Feeds
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

Theme Twelve.
Where will that bloginfo be? In what file?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press - Comments RSS. How do you remove the link?

Post by Celauran »

The Twenty Twelve theme that comes with WP? Under Meta in the sidebar? That's a widget, and I believe part of the WP core. Probably better to remove the widget from the sidebar entirely than to start editing core files.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

If we do that, how do we then login and Logout?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

Seems strange that WP allows a "dead link" on it's site. Considering how Google and SEO loves it so much.

I also think the Entries RSS is good for Google!!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press - Comments RSS. How do you remove the link?

Post by Celauran »

simonmlewis wrote:If we do that, how do we then login and Logout?
/wp-admin
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

And how will Google cache it all from the Entries RSS?
We just want that A HREF tag removed. It MUST be easy. It must be in a template somewhere?!?!?!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press - Comments RSS. How do you remove the link?

Post by Celauran »

Like I already said, it's a core widget. It's defined in wp-includes/default-widgets.php specifically on line 317.

Code: Select all

class WP_Widget_Meta extends WP_Widget {

	function __construct() {
		$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, & WordPress.org links.") );
		parent::__construct('meta', __('Meta'), $widget_ops);
	}

	function widget( $args, $instance ) {
		extract($args);
		$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title'], $instance, $this->id_base);

		echo $before_widget;
		if ( $title )
			echo $before_title . $title . $after_title;
?>
			<ul>
			<?php wp_register(); ?>
			<li><?php wp_loginout(); ?></li>
			<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
			<li><a href="<?php bloginfo('comments_rss2_url');/* Here it is! */  ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
			<?php echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>',
				esc_url( __( 'http://wordpress.org/' ) ),
				esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),
				_x( 'WordPress.org', 'meta widget link text' )
			) ); ?>
			<?php wp_meta(); ?>
			</ul>
<?php
		echo $after_widget;
	}
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

Got it. Thanks.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press - Comments RSS. How do you remove the link?

Post by Celauran »

Bear in mind that, as this is a core file, it may be overwritten any time you update WordPress, undoing any changes you've made.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

Yes, I do that myself, so when that happens, I will check it.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

In the latest version of WordPress, theme Twenty Twelve, where is this code found to remove just the line: "Comments RSS"?
I can remove that entire blog via the RSS area in Admin, but I only want to remove that line.

I thought I found it, but I remove it but it remains!
Attachments
wp.jpg
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Word Press - Comments RSS. How do you remove the link?

Post by Celauran »

It hasn't moved. It's still part of a core widget, still line 317 of wp-includes/default-widgets.php
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Word Press - Comments RSS. How do you remove the link?

Post by simonmlewis »

So it is - works. Clean sitemap now.
Many thanks again.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply