Custom Meta Widget - Version 1.3

Version Description

  • Added a custom link option (disabled by default).
  • Updated screenshots 1-3.
  • Changed plugin name on Appearance > Widgets menu to 'Custom Meta' instead of 'Custom Meta Widget' which was redundant.
  • Added additional code commenting.
Download this release

Release Info

Developer bitacre
Plugin Icon wp plugin Custom Meta Widget
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

Files changed (5) hide show
  1. customMeta.php +53 -29
  2. readme.txt +15 -6
  3. screenshot-1.png +0 -0
  4. screenshot-2.png +0 -0
  5. screenshot-3.png +0 -0
customMeta.php CHANGED
@@ -2,15 +2,10 @@
2
  /*
3
  Plugin Name: Custom Meta Widget
4
  Plugin URI: http://wikiduh.com/plugins/custom-meta-widget
5
- Description: Clone of the standard Meta widget plus option to hide log in/out, admin, feed and WordPress links.
6
- Version: 1.2
7
  Author: bitacre
8
  Author URI: http://wikiduh.com/
9
- Acknowledgements:
10
- This code is largely derived from one of the many freely available
11
- and tremendously helpful tutoials on the Azulia Designs website
12
- (http://azuliadesigns.com) created by the heroic Tim Trott.
13
-
14
  License: GPLv2
15
  Copyright 2011 bitacre (plugins@wikiduh.com)
16
  */
@@ -18,15 +13,15 @@ License: GPLv2
18
  class customMetaWidget extends WP_Widget {
19
 
20
  function customMetaWidget() { // plugin structure:
21
- $widget_ops = array('classname' => 'customMetaWidget', 'description' => 'Clone of the standard Meta widget PLUS options to show or hide: log in/out, admin, feed and WordPress links.');
22
- $this->WP_Widget('customMetaWidget', 'Custom Meta Widget', $widget_ops);
23
  }
24
 
25
  function form($instance) { // form print function:
26
- $instance = wp_parse_args( (array) $instance, array( 'title' => 'Meta', 'register'=>1, 'login'=>1,'entryrss'=>1, 'commentrss'=>1, 'wordpress'=>1 ) ); // set default values ?>
27
 
28
- <p><label for="<?php echo $this->get_field_id('title'); ?>">Display title:&nbsp;</label></p>
29
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
30
 
31
  <p><label for="<?php echo $this->get_field_id('register'); ?>">Show 'Register/Admin' link?&nbsp;</label>
32
  <input id="<?php echo $this->get_field_id('register'); ?>" name="<?php echo $this->get_field_name('register'); ?>" type="checkbox" <?php if(esc_attr($instance['register'])) echo 'checked="yes"'; ?> value="1" /></p>
@@ -42,6 +37,18 @@ class customMetaWidget extends WP_Widget {
42
 
43
  <p><label for="<?php echo $this->get_field_id('wordpress'); ?>">Show 'Wordpress' link?&nbsp;</label>
44
  <input id="<?php echo $this->get_field_id('wordpress'); ?>" name="<?php echo $this->get_field_name('wordpress'); ?>" type="checkbox" <?php if(esc_attr($instance['wordpress'])) echo 'checked="yes"'; ?> value="1" /></p>
 
 
 
 
 
 
 
 
 
 
 
 
45
  <?php }
46
 
47
  function update($new_instance, $old_instance) { // save widget options:
@@ -52,30 +59,47 @@ class customMetaWidget extends WP_Widget {
52
  $instance['entryrss'] = $new_instance['entryrss'];
53
  $instance['commentrss'] = $new_instance['commentrss'];
54
  $instance['wordpress'] = $new_instance['wordpress'];
 
 
 
55
  return $instance;
56
  }
57
 
58
  function widget($args, $instance) { // widget sidebar output
59
  extract($args, EXTR_SKIP);
60
  echo $before_widget; // pre-widget code from themes
61
- echo '<!-- Custom Meta Widget. Plugin URL: http://wikiduh.com/plugins/custom-meta-widget -->';
62
- $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); // if no title, use default
63
- if (!empty($title)) echo $before_title . esc_attr($instance['title']) . $after_title; // echo title
64
- echo '<ul>';
65
- if(esc_attr($instance['register'])) wp_register('<li>', '</li>'); // 1. register link
66
- if(esc_attr($instance['login'])) echo '<li>' . wp_loginout(NULL,FALSE) . '</li>'; // 2. login link
67
- if(esc_attr($instance['entryrss'])) { // 3. entries rss link
68
- echo '<li><a href="';
69
- bloginfo('rss2_url');
70
- echo '" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>';
71
- }
72
- if(esc_attr($instance['commentrss'])) { // 4. comments rss
73
- echo '<li><a href="';
74
- bloginfo('comments_rss2_url');
75
- echo '" title="Syndicate this site using RSS 2.0">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>';
76
- }
 
 
 
 
 
 
 
 
 
77
  if(esc_attr($instance['wordpress'])) echo '<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li>'; // 5. wordpress.org link
78
- echo '</ul>';
 
 
 
 
 
79
  echo $after_widget; // after widget code from themes
80
  }
81
  }
2
  /*
3
  Plugin Name: Custom Meta Widget
4
  Plugin URI: http://wikiduh.com/plugins/custom-meta-widget
5
+ Description: Clone of the standard Meta widget plus options to hide log in/out, admin, feed and WordPress/custom links.
6
+ Version: 1.3
7
  Author: bitacre
8
  Author URI: http://wikiduh.com/
 
 
 
 
 
9
  License: GPLv2
10
  Copyright 2011 bitacre (plugins@wikiduh.com)
11
  */
13
  class customMetaWidget extends WP_Widget {
14
 
15
  function customMetaWidget() { // plugin structure:
16
+ $widget_ops = array('classname' => 'customMetaWidget', 'description' => 'Clone of the standard Meta widget with options to show or hide log in/out, admin, feed, WordPress/custom links.');
17
+ $this->WP_Widget('customMetaWidget', 'Custom Meta', $widget_ops);
18
  }
19
 
20
  function form($instance) { // form print function:
21
+ $instance = wp_parse_args( (array) $instance, array( 'title' => 'Meta', 'register'=>1, 'login'=>1, 'entryrss'=>1, 'commentrss'=>1, 'wordpress'=>1, 'showcustom'=>0, 'customurl'=>NULL, 'customtext'=>NULL ) ); // set default values ?>
22
 
23
+ <p><label for="<?php echo $this->get_field_id('title'); ?>">Display title:&nbsp;</label>
24
+ <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" /></p>
25
 
26
  <p><label for="<?php echo $this->get_field_id('register'); ?>">Show 'Register/Admin' link?&nbsp;</label>
27
  <input id="<?php echo $this->get_field_id('register'); ?>" name="<?php echo $this->get_field_name('register'); ?>" type="checkbox" <?php if(esc_attr($instance['register'])) echo 'checked="yes"'; ?> value="1" /></p>
37
 
38
  <p><label for="<?php echo $this->get_field_id('wordpress'); ?>">Show 'Wordpress' link?&nbsp;</label>
39
  <input id="<?php echo $this->get_field_id('wordpress'); ?>" name="<?php echo $this->get_field_name('wordpress'); ?>" type="checkbox" <?php if(esc_attr($instance['wordpress'])) echo 'checked="yes"'; ?> value="1" /></p>
40
+
41
+ <p> <label for="<?php echo $this->get_field_id('showcustom'); ?>">Show Custom link?&nbsp;</label>
42
+ <input id="<?php echo $this->get_field_id('showcustom'); ?>" name="<?php echo $this->get_field_name('showcustom'); ?>" type="checkbox" <?php if(esc_attr($instance['showcustom'])) echo 'checked="yes"'; ?> value="1" />
43
+
44
+ <div style="margin-left:20px;"><label for="<?php echo $this->get_field_id('customurl'); ?>">URL:&nbsp;</label>
45
+ <input id="<?php echo $this->get_field_id('customurl'); ?>" name="<?php echo $this->get_field_name('customurl'); ?>" type="text" value="<?php echo esc_attr($instance['customurl']); ?>" /></div>
46
+
47
+ <div style="margin-left:20px;"><label for="<?php echo $this->get_field_id('customtext'); ?>">Text:&nbsp;&nbsp;</label>
48
+ <input id="<?php echo $this->get_field_id('customtext'); ?>" name="<?php echo $this->get_field_name('customtext'); ?>" type="text" value="<?php echo esc_attr($instance['customtext']); ?>" /></div>
49
+
50
+ </p>
51
+
52
  <?php }
53
 
54
  function update($new_instance, $old_instance) { // save widget options:
59
  $instance['entryrss'] = $new_instance['entryrss'];
60
  $instance['commentrss'] = $new_instance['commentrss'];
61
  $instance['wordpress'] = $new_instance['wordpress'];
62
+ $instance['showcustom'] = $new_instance['showcustom'];
63
+ $instance['customurl'] = $new_instance['customurl'];
64
+ $instance['customtext'] = $new_instance['customtext'];
65
  return $instance;
66
  }
67
 
68
  function widget($args, $instance) { // widget sidebar output
69
  extract($args, EXTR_SKIP);
70
  echo $before_widget; // pre-widget code from themes
71
+ echo '
72
+ <!-- Custom Meta Widget. Plugin URL: http://wikiduh.com/plugins/custom-meta-widget -->
73
+ ';
74
+
75
+ $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); // if no title, use default
76
+ if (!empty($title)) echo $before_title . esc_attr($instance['title']) . $after_title; // echo title
77
+
78
+ echo '<ul>'; // start meta widget unordered list
79
+
80
+ if(esc_attr($instance['register'])) wp_register('<li>', '</li>'); // 1. register link
81
+
82
+ if(esc_attr($instance['login'])) echo '<li>' . wp_loginout(NULL,FALSE) . '</li>'; // 2. login link
83
+
84
+ if(esc_attr($instance['entryrss'])) { // 3. entries rss link
85
+ echo '<li><a href="';
86
+ bloginfo('rss2_url');
87
+ echo '" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>';
88
+ }
89
+
90
+ if(esc_attr($instance['commentrss'])) { // 4. comments rss
91
+ echo '<li><a href="';
92
+ bloginfo('comments_rss2_url');
93
+ echo '" title="Syndicate this site using RSS 2.0">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>';
94
+ }
95
+
96
  if(esc_attr($instance['wordpress'])) echo '<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li>'; // 5. wordpress.org link
97
+
98
+ if( esc_attr($instance['showcustom']) ) echo '<li><a href="' . esc_attr($instance['customurl']) . '">' . esc_attr($instance['customtext']) . '</a></li>'; // 6. custom user-defined link
99
+
100
+
101
+ echo '</ul>'; // end meta widget unordered list
102
+
103
  echo $after_widget; // after widget code from themes
104
  }
105
  }
readme.txt CHANGED
@@ -5,15 +5,15 @@ Donate link: http://wikiduh.com/donate
5
  Tags: meta, hide, link, admin, simple, widget, default, wordpress.org, change, rss, remove, login
6
  Requires at least: 2.8
7
  Tested up to: 3.3.1
8
- Stable tag: 1.2
9
 
10
- Clone of the standard Meta widget plus option to hide log in/out, admin, feed and WordPress links.
11
 
12
  == Description ==
13
 
14
  The standard Meta widget that comes with WordPress offers no customization and requires you to show all 5 links on the sidebar (register, login, entries rss, comments rss, and wordpress.org).
15
 
16
- This plugin acts in exactly the same way as the standard Meta widget EXCEPT that it adds options to the widget's setup page which allow you to HIDE any of these 5 links.
17
 
18
  == Installation ==
19
 
@@ -28,9 +28,9 @@ This plugin acts in exactly the same way as the standard Meta widget EXCEPT that
28
 
29
  This plugin does not modify the standard WordPress Meta widget. It is a completely seperate widget titled 'Custom Meta.' If you are currently using the standard Meta widget, you will have to replace it with the Custom Meta widget on the Appearance > Widgets menu.
30
 
31
- = Which links can I hide? =
32
 
33
- You can remove any, all, or none of the links which appear on the standard Meta widget.
34
 
35
  = Why did you make this? =
36
 
@@ -43,11 +43,17 @@ Can I? Yes. Will I? Yes, if I think it would be a helpful addition. I'm trying t
43
  == Screenshots ==
44
 
45
  1. The widget's options page on the Appearance > Widgets menu.
46
- 2. The widget displayed on the sidebar with 2 links hidden.
47
  3. Comparison of options between the standard and Custom Meta Widget.
48
 
49
  == Changelog ==
50
 
 
 
 
 
 
 
51
  = 1.2 =
52
  * Fixed reference to non-existent instance error.
53
 
@@ -62,6 +68,9 @@ Can I? Yes. Will I? Yes, if I think it would be a helpful addition. I'm trying t
62
 
63
  == Upgrade Notice ==
64
 
 
 
 
65
  = 1.2 =
66
 
67
  Fixes a code error.
5
  Tags: meta, hide, link, admin, simple, widget, default, wordpress.org, change, rss, remove, login
6
  Requires at least: 2.8
7
  Tested up to: 3.3.1
8
+ Stable tag: 1.3
9
 
10
+ Clone of the standard Meta widget plus options to hide log in/out, admin, feed and WordPress/custom links.
11
 
12
  == Description ==
13
 
14
  The standard Meta widget that comes with WordPress offers no customization and requires you to show all 5 links on the sidebar (register, login, entries rss, comments rss, and wordpress.org).
15
 
16
+ This plugin acts in exactly the same way as the standard Meta widget except that it adds options to the widget's setup page which allow you control which of these 5 links is displayed, with the additional option to add your own custom link.
17
 
18
  == Installation ==
19
 
28
 
29
  This plugin does not modify the standard WordPress Meta widget. It is a completely seperate widget titled 'Custom Meta.' If you are currently using the standard Meta widget, you will have to replace it with the Custom Meta widget on the Appearance > Widgets menu.
30
 
31
+ = Which links can I hide/show? =
32
 
33
+ You can remove any, all, or none of the links which appear on the standard Meta widget. You are also able to add a custom link to the list if you wish.
34
 
35
  = Why did you make this? =
36
 
43
  == Screenshots ==
44
 
45
  1. The widget's options page on the Appearance > Widgets menu.
46
+ 2. The widget displayed on the sidebar with 2 links hidden and a custom link added.
47
  3. Comparison of options between the standard and Custom Meta Widget.
48
 
49
  == Changelog ==
50
 
51
+ = 1.3 =
52
+ * Added a custom link option (disabled by default).
53
+ * Updated screenshots 1-3.
54
+ * Changed plugin name on Appearance > Widgets menu to 'Custom Meta' instead of 'Custom Meta Widget' which was redundant.
55
+ * Added additional code commenting.
56
+
57
  = 1.2 =
58
  * Fixed reference to non-existent instance error.
59
 
68
 
69
  == Upgrade Notice ==
70
 
71
+ = 1.3 =
72
+ Adds new custom link functionality.
73
+
74
  = 1.2 =
75
 
76
  Fixes a code error.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file