Customizing WordPress Default Meta Widget
Author: Jay | Date: September 12, 2009 | Please Comment!This is my first time using WordPress 2.8. I actually upgraded from WordPress version very old. I’m very impressed by the new features. I really enjoy having the widgets on the sidebar. It has made things very easy to customize. WordPress has always had a good track record for making things easy to install, upgrade, and customize. However, when dealing with some of the customizations on the things that I wanted to do it wasn’t as easy as I was expecting.
Take for example, the Meta widget. I wanted to do something easy and just remove three of the links: Entries RSS, Comments RSS, and WordPress.org. I went to the widgets page in the admin section to just click the options to remove those links. To my surprise there were no options to do this!
I then started my day long quest to figure out what I could do to remove those three links. First, I went to Google and started searching for solutions. I found two that seemed promising. One I found on WordPress.org in a message thread. The solution was to create a text widget. However, this wouldn’t solve the problem of wanting to have the login, register, logout, and site admin links available.
Cross this option out.
The second option I found was a blog post on how to remove the links from the widget PHP code. Problem was that the post didn’t go into any details about how to do this. It just said to edit a file and make sure to back it up. It was not helpful.
Cross this option out.
After about an hour of research I decided to just dive into the code. I figured I’ve customized earlier versions of WordPress and other software packages so how hard could it really be?
I went and read the documentation on WordPress.org about widgets, how to create them, how to incorporate them into your current theme, etc. What I found really wasn’t too helpful. However, it did give me direction as to where to start and a great overview of how widgets work.
In order to customize the Meta widget I would have to look in the /wp-includes directory for the super class in the widgets.php file. This file has all the methods for registering your widget with WordPress so it knows it is available to use. Next, I found the default-widgets.php file.
This file actually has a lot of classes in it that have all the default widgets that WordPress comes with. It’s in this file which you need to edit. Around line 280 you’ll find a class called WP_Widget_Meta. This is the class you’ll want to edit. You’ll find the following code:
<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'); ?></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'); ?></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>
That is exactly what I was looking for! I just commented out those three lines of code and uploaded the file to my site and customization done!
Conclusion:
Although I find WordPress to be a great blogging software package and very easy to get up and running, some of the custumizations are just difficult to figure out. If you know code it shouldn’t be an issue, but for those who don’t it’s just too difficult. I really hope that in the future WordPress sees the weaknesses of their default widgets and does something to improve their usability. Maybe I’ll do a little more research on widgets and actually create a useful Meta widget. If that’s something you would find useful let me know and I’ll probably take the time and create it for the community!
















Leave a reply!