Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Customize Meta Widget 2011
- Plugin URI: http://wordpress.org/extend/plugins/customize-meta-widget/
- Description: Add or remove links from meta widget. Modified by brasofilo (v3): update of functions calls, error correction in the original code and easy customization.
- Author: Jehy, brasofilo
- Author URI: http://jehy.en.html
- Version: 0.3
- Min WP Version: 2.6
- Max WP Version: 3.2.1
- */
- if ( !function_exists('replace_meta_widget_2011') ) {
- // WIDGET TITLE IN FRONTEND
- $the_widget_meta_modified_title = "My Meta Widget";
- // TO USE THIS LINK, CHANGE TO TRUE, MODIFY THE OTHER VALUES
- $the_extra_link_1_on_off = false;
- $the_extra_link_1_href = "http://google.com";
- $the_extra_link_1_title = "Link to Google";
- $the_extra_link_1_text = "Search what you're looking for";
- // TO USE THIS LINK, CHANGE TO TRUE, MODIFY THE OTHER VALUES
- $the_extra_link_2_on_off = false;
- $the_extra_link_2_href = "http://bing.com";
- $the_extra_link_2_title = "Link to Bing";
- $the_extra_link_2_text = "Search not what you're looking";
- // LINKS BUILDER - DON'T EDIT
- $the_extra_link_1_meta_modified = '<li><a href="' . $the_extra_link_1_href . '" title="' . $the_extra_link_1_title . '">' . $the_extra_link_1_text . '</a></li>';
- $the_extra_link_2_meta_modified = '<li><a href="' . $the_extra_link_2_href . '" title="' . $the_extra_link_2_title . '">' . $the_extra_link_2_text . '</a></li>';
- function replace_meta_widget_2011()
- {
- global $the_widget_meta_modified_title;
- wp_unregister_sidebar_widget ('meta');
- $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Modified Meta Widget, please check plugin file to customize") );
- wp_register_sidebar_widget('meta', 'Meta Slim', 'replace_meta_widget_2011_do_widget', $widget_ops);
- }
- add_action('widgets_init','replace_meta_widget_2011');
- function replace_meta_widget_2011_do_widget($args) {
- global $the_extra_link_1_on_off, $the_extra_link_1_meta_modified, $the_extra_link_2_on_off, $the_extra_link_2_meta_modified, $the_widget_meta_modified_title;
- extract($args);
- echo $before_widget;
- echo $before_title . $the_widget_meta_modified_title . $after_title;
- #WIDGET BEGINS HERE. ?>
- <ul>
- <?php wp_register();?>
- <li><?php wp_loginout(); ?></li>
- <?php if($the_extra_link_1_on_off) echo $the_extra_link_1_meta_modified; ?>
- <?php if($the_extra_link_2_on_off) echo $the_extra_link_2_meta_modified; ?>
- <?php wp_meta(); ?>
- </ul>
- <?php
- #WIDGET ENDS HERE.
- echo $after_widget;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement