Custom Meta Widget - Version 1.0

Version Description

  • First released version.
  • There may still be bugs, but I can't find any.

=

Download this release

Release Info

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

Version 1.0

Files changed (5) hide show
  1. customMeta.php +117 -0
  2. readme.txt +73 -0
  3. screenshot-1.png +0 -0
  4. screenshot-2.png +0 -0
  5. screenshot-3.png +0 -0
customMeta.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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 show or hide: log in/out, admin, feed and WordPress links.
6
+ Version: 1.0
7
+ Author: bitacre
8
+ Author URI: http://codex.wordpress.org/User:Bitacre
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
+ License: CC BY-SA 3.0 (GPLv2 complaiant)
14
+ Copyright 2011 bitacre (email : wp@wikiduh.com)
15
+
16
+ This program is distributed under the Creative Commons
17
+ Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence. You
18
+ may copy, distribute, transmit, adapt, and make commercial use
19
+ of this work so long as you attribute the original author by
20
+ including the URL http://wikiduh.com/plugin/wp/custom_meta
21
+ in your project's source.
22
+
23
+ This program is distributed in the hope that it will be useful,
24
+ but without ANY warranty; without even the implied warranty of
25
+ merchantability or fitness for a particular purpose.
26
+
27
+ See license.txt for more information.
28
+
29
+
30
+ */
31
+ class customMetaWidget extends WP_Widget {
32
+
33
+ function customMetaWidget() {
34
+ $widget_ops = array('classname' => 'customMetaWidget', 'description' => 'A simple alternative to the vanilla Meta widget allowing you to chose which links are shown.' );
35
+ $this->WP_Widget('customMetaWidget', 'Custom Meta Widget', $widget_ops);
36
+ }
37
+
38
+ function form($instance) {
39
+ $instance = wp_parse_args( (array) $instance, array( 'title' => 'Meta', 'register'=>'true', 'login'=>'true','entriesrss'=>'true', 'commentsrss'=>'true', 'wordpress'=>'true' ) ); // set default values
40
+ $title = $instance['title'];
41
+ $register = $instance['register'];
42
+ $login = $instance['login'];
43
+ $entriesrss = $instance['entriesrss'];
44
+ $commentsrss = $instance['commentsrss'];
45
+ $wordpress = $instance['wordpress'];
46
+ ?>
47
+ <p><label for="<?php echo $this->get_field_id('title'); ?>">Display title:&nbsp;
48
+ <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
49
+ </label></p>
50
+
51
+ <p><label for="<?php echo $this->get_field_id('register'); ?>">
52
+ <input id="<?php echo $this->get_field_id('register'); ?>" name="<?php echo $this->get_field_name('register'); ?>" type="checkbox" <?php if(attribute_escape($register)=='true') echo 'checked="yes"'; ?> value="true" />
53
+ Show 'Register/Admin' link?&nbsp;</label></p>
54
+
55
+ <p><label for="<?php echo $this->get_field_id('login'); ?>">
56
+ <input id="<?php echo $this->get_field_id('login'); ?>" name="<?php echo $this->get_field_name('login'); ?>" type="checkbox" <?php if(attribute_escape($login)=='true') echo 'checked="yes"'; ?> value="true" />
57
+ Show 'Log in/out' link?&nbsp;</label></p>
58
+
59
+ <p><label for="<?php echo $this->get_field_id('entriesrss'); ?>">
60
+ <input id="<?php echo $this->get_field_id('entriesrss'); ?>" name="<?php echo $this->get_field_name('entriesrss'); ?>" type="checkbox" <?php if(attribute_escape($entriesrss)=='true') echo 'checked="yes"'; ?> value="true" />
61
+ Show 'Entries RSS' link?&nbsp;</label></p>
62
+
63
+ <p><label for="<?php echo $this->get_field_id('commentsrss'); ?>">
64
+ <input id="<?php echo $this->get_field_id('commentsrss'); ?>" name="<?php echo $this->get_field_name('commentsrss'); ?>" type="checkbox" <?php if(attribute_escape($commentsrss)=='true') echo 'checked="yes"'; ?> value="true" />
65
+ Show 'Comments RSS' link?&nbsp;</label></p>
66
+
67
+ <p><label for="<?php echo $this->get_field_id('wordpress'); ?>">
68
+ <input id="<?php echo $this->get_field_id('wordpress'); ?>" name="<?php echo $this->get_field_name('wordpress'); ?>" type="checkbox" <?php if(attribute_escape($wordpress)=='true') echo 'checked="yes"'; ?> value="true" />
69
+ Show 'Wordpress' link?&nbsp;</label></p>
70
+
71
+ <?php
72
+ }
73
+
74
+ function update($new_instance, $old_instance) {
75
+ $instance = $old_instance;
76
+ $instance['title'] = $new_instance['title'];
77
+ $instance['register'] = $new_instance['register'];
78
+ $instance['login'] = $new_instance['login'];
79
+ $instance['entriesrss'] = $new_instance['entriesrss'];
80
+ $instance['commentsrss'] = $new_instance['commentsrss'];
81
+ $instance['wordpress'] = $new_instance['wordpress'];
82
+ return $instance;
83
+ }
84
+
85
+ function widget($args, $instance) {
86
+ extract($args, EXTR_SKIP); // extract values
87
+ $register = $instance['register'];
88
+ $login = $instance['login'];
89
+ $entriesrss = $instance['entriesrss'];
90
+ $commentsrss = $instance['commentsrss'];
91
+ $wordpress = $instance['wordpress'];
92
+ echo $before_widget;
93
+ $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
94
+ if (!empty($title))
95
+ echo $before_title . $title . $after_title;
96
+
97
+ // main widget code
98
+ echo '<ul>';
99
+ if($register=='true') wp_register('<li>', '</li>');
100
+ if($login=='true') echo '<li>' . wp_loginout(NULL,FALSE) . '</li>';
101
+ if($entriesrss=='true') {
102
+ echo '<li><a href="';
103
+ bloginfo('rss2_url');
104
+ echo '" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>';
105
+ }
106
+ if($commentsrss=='true') {
107
+ echo '<li><a href="';
108
+ bloginfo('comments_rss2_url');
109
+ echo '" title="Syndicate this site using RSS 2.0">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>';
110
+ }
111
+ if($wordpress=='true') echo '<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li>';
112
+ echo '</ul>';
113
+ echo $after_widget;
114
+ }
115
+ }
116
+
117
+ add_action( 'widgets_init', create_function('', 'return register_widget("customMetaWidget");') );?>
readme.txt ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Custom Meta Widget ===
2
+ Plugin URI: http://wikiduh.com/plugins/custom-meta-widget
3
+ Contributors: bitacre
4
+ 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.2.1
8
+ Stable tag: 1.0
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
+
20
+ 1. Download the latest zip file and extract the 'custom-meta-widget' directory.
21
+ 2. Upload the 'custom-meta-widget' directory inside your '/wp-content/plugins/' directory.
22
+ 3. Activate the 'Custom Meta Widget' on the 'Plugins' menu in WordPress.
23
+ 4. Add the 'Custom Meta' widget to your sidebar (using the Appearance > Widgets menu) and choose which links you want hidden from the sidebar.
24
+
25
+ == Frequently Asked Questions ==
26
+
27
+ = Why does my Meta widget look the same? =
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
+
37
+ I didn't like having the 'Comments RSS' link on the sidebar, but did like having the rest of them. I couldn't find a plugin to do that and manually editing the code to accomplish this is a dirty hack and breaks with every update, so I created a crude plugin to remove just the 'Comments RSS' link. I then cleaned this up and added an options page for all the links so that no one else would have to do this in the future.
38
+
39
+ = Can you add this feature I just thought of? =
40
+
41
+ Can I? Yes. Will I? Yes, if I think it would be a helpful addition. I'm trying to keep things clean and simple, but there's always room for improvement, so let me know if you think a feature is lacking!
42
+
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.1 =
52
+ * Minor improvements to code architechture.
53
+ * Increased compliance with WordPress style standards.
54
+ * Significantly more code commenting.
55
+
56
+ = 1.0 =
57
+ * First released version.
58
+ * There may still be bugs, but I can't find any.
59
+
60
+ == Upgrade Notice ==
61
+
62
+ = 1.1 =
63
+
64
+ Not essential, no bug fixes just minor structural code changes. (Mostly a test of the SVN repository system which I am new at.)
65
+
66
+ == Support ==
67
+
68
+ * [Plugin Homepage](http://wikiduh.com/plugins/custom-meta-widget)
69
+ * [plugins@wikiduh.com](mailto:plugins@wikiduh.com)
70
+
71
+ == Donations ==
72
+
73
+ [Donations](http://wikiduh.com/donations) are graciously accepted to support the continued development and maintenance of this and other plugins. We currently accept Alertpay, Paypal, and kind words.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file