brasofilo

Customize Meta Widget MOD

Nov 28th, 2011
194
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. Plugin Name: Customize Meta Widget 2011
  4. Plugin URI: http://wordpress.org/extend/plugins/customize-meta-widget/
  5. 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.
  6. Author: Jehy, brasofilo
  7. Author URI: http://jehy.en.html
  8. Version: 0.3
  9. Min WP Version: 2.6
  10. Max WP Version: 3.2.1
  11. */
  12.  
  13. if ( !function_exists('replace_meta_widget_2011') ) {
  14.     // WIDGET TITLE IN FRONTEND
  15.     $the_widget_meta_modified_title = "My Meta Widget";
  16.  
  17.     // TO USE THIS LINK, CHANGE TO TRUE, MODIFY THE OTHER VALUES
  18.     $the_extra_link_1_on_off = false;
  19.     $the_extra_link_1_href = "http://google.com";
  20.     $the_extra_link_1_title = "Link to Google";
  21.     $the_extra_link_1_text = "Search what you're looking for";
  22.  
  23.     // TO USE THIS LINK, CHANGE TO TRUE, MODIFY THE OTHER VALUES
  24.     $the_extra_link_2_on_off = false;
  25.     $the_extra_link_2_href = "http://bing.com";
  26.     $the_extra_link_2_title = "Link to Bing";
  27.     $the_extra_link_2_text = "Search not what you're looking";
  28.  
  29.  
  30.     // LINKS BUILDER - DON'T EDIT
  31.     $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>';
  32.     $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>';
  33.  
  34.     function replace_meta_widget_2011()
  35.     {
  36.         global $the_widget_meta_modified_title;
  37.         wp_unregister_sidebar_widget ('meta');
  38.         $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Modified Meta Widget, please check plugin file to customize") );
  39.         wp_register_sidebar_widget('meta', 'Meta Slim', 'replace_meta_widget_2011_do_widget', $widget_ops);
  40.     }
  41.  
  42.     add_action('widgets_init','replace_meta_widget_2011');
  43.  
  44.     function replace_meta_widget_2011_do_widget($args) {
  45.         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;
  46.         extract($args);
  47.         echo $before_widget;
  48.         echo $before_title . $the_widget_meta_modified_title . $after_title;
  49.         #WIDGET BEGINS HERE. ?>
  50.             <ul>
  51.             <?php wp_register();?>
  52.             <li><?php wp_loginout(); ?></li>
  53.             <?php if($the_extra_link_1_on_off) echo $the_extra_link_1_meta_modified; ?>
  54.             <?php if($the_extra_link_2_on_off) echo $the_extra_link_2_meta_modified; ?>
  55.             <?php wp_meta(); ?>
  56.             </ul>
  57.         <?php
  58.         #WIDGET ENDS HERE.
  59.         echo $after_widget;
  60.     }
  61. }
RAW Paste Data