28Jan/109
Change Your WordPress Meta Widget
Would you like to change your meta links contained in your WordPress sidebar widget in version 2.9.1?
First open up your default-widgets.php in your wp-includes folder, then look for class WP_Widget_Meta extends WP_Widget - shown below.
Quick Note: I recommend using a plugin for this, as this example will require you to edit a core file which maybe changed back when your wordpress application is upgraded.
class WP_Widget_Meta extends WP_Widget {
function WP_Widget_Meta() {
$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
$this->WP_Widget('meta', __('Meta'), $widget_ops);
}
function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);
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'); ?>" 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>
<li><a href="http://wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>
<?php wp_meta(); ?>
</ul>
<?php
echo $after_widget;
}
Then replace it with this modified class. Note: I just commented out the RSS Feeds and WordPress Link. Shown in red.
class WP_Widget_Meta extends WP_Widget {
function WP_Widget_Meta() {
$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );
$this->WP_Widget('meta', __('Meta'), $widget_ops);
}
function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Meta') : $instance['title']);
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'); ?>" 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>
<li><a href="http://wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org</a></li>-->
<?php wp_meta(); ?>
</ul>
<?php
echo $after_widget;
 }
Hope this works for you.
Post Archives
Post Categories
Advertisements
Most Recent Posts
- The Official Social Network Trailer
- Eminem – Love the way you lie Feat. Rihanna, Megan Fox, and a Hobbit.
- Windows 8 has been leaked. No Joke.
Follow Me On Twitter
- RT @williamskinner The Official Social Network Trailer - http://tinyurl.com/3xwdys9
- Good morning for some #fishing
- http://twitpic.com/2j5heg - Fishing in birks falls
March 18th, 2010 - 23:49
HI Bill,
Many thanks for this, it worked a treat.
Do you know how I can change the actual name of the meta widget, so it says something like “Log In” instead of “Meta” when displayed on my side bar?
Once again many thanks for this, it is very much appreciated.
All the best.
Take care,
Keith
March 19th, 2010 - 08:14
Hi Keith,
The easiet way is to login to your admin area, then click on Appearance / Widgets. You will see a widget called META – drag that over to your sidebar. Click on the drop down arrow, and fill out the box that says TITLE, then hit save. If you use this way you will have to drag in other widgets like recent posts, or categories, etc as you will now be using a dynamic sidebar, not the static sidebar.php located in your /wp-content/ themes/default (or whatever the name of your theme is) folder.
If this isn’t the way you want to go, you can always modify the sidebar.php file. Scroll down until you see Meta, or do a find with your web editor. Next, just change it to whatever you like, save the file, then upload to your server.
Hope this helps.
Bill
March 19th, 2010 - 23:26
While this may be a solution to altering the meta widget it’s not advisable unless you adhere to strict documentation of your code. After updating to the latest WordPress release this will be wiped out and you will have to repeat your steps again. I’ve searched high and low for a solution to this and have only found one that worked. However it took me hours to get it to work. If your familiar with the sandbox WordPress theme you can find it in the functions near the bottom of the file near line 590.
Just a heads up!
March 20th, 2010 - 19:34
Hi Bill,
I feel like a bit on an idiot now as I was trying to follow your advice but nothing seemed to work, it was only when I took a break and looked at things afresh I remembered I had previously tried to use a plug-in to alter the title of the meta widget, once this was removed everything worked a treat.
I would just to thank you for all your help and assistance, it is greatly appreciated.
All the best.
Take care,
Keith
March 22nd, 2010 - 16:19
Anytime Keith,
Thanks for visiting BillSkinner.com.
April 3rd, 2010 - 14:02
Thanks!
Your instructions were very clear and straightforward and worked first time without even an Apache restart. I also don’t mind that I will have to reapply the “fix” when I upgrade.
Have you thought about doing any posts about the effectiveness of advertising a blog to increase traffic to the blog earn more from adds on the blog?
Sounds circular which it is. I’m just wondering what you think of the approach?
April 11th, 2010 - 17:29
im a serial reader
April 12th, 2010 - 13:39
Hi Bill. I never like hacking the core. In this case, I think it would be better to build a new widget that allows you to set the title, or use a plug-in like Enhanced Meta Widget.
If you are interested in building your own new widget, Justin Tadlock has great article about how to do this. It would be fairly simple, since you are just recycling the code from the WP Core and adding a title to it.
August 11th, 2010 - 23:40
Really nice post! Your writing is so fresh in comparison to most other writers. Thanks for writing when you get the chance to, I’ll be sure to read more!