1
|
1 |
<?php |
|
2 |
/** |
|
3 |
* Plugin Name: Hybrid Hook Widgets |
|
4 |
* Plugin URI: http://themehybrid.com/themes/hybrid/hybrid-hook-widgets |
|
5 |
* Description: Adds widget areas to the action hooks in the Hybrid theme, allowing you to customize your site without digging into the theme files. |
|
6 |
* Version: 0.1 |
|
7 |
* Author: Justin Tadlock |
|
8 |
* Author URI: http://justintadlock.com |
|
9 |
* |
|
10 |
* This plugin was created so that users with little or no XHTML and PHP |
|
11 |
* knowledge could take advantage of Hybrid's built-in hook system. It allows |
|
12 |
* them to add widgets to specific action hooks. The user must have WordPress |
|
13 |
* version 2.8 or higher installed to use this plugin. |
|
14 |
* |
|
15 |
* @copyright 2008 - 2009 |
|
16 |
* @version 0.1 |
|
17 |
* @author Justin Tadlock |
|
18 |
* @link http://themehybrid.com/themes/hybrid/hybrid-hook-widgets |
|
19 |
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|
20 |
* |
|
21 |
* This program is distributed in the hope that it will be useful, |
|
22 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
24 |
* |
|
25 |
* @package HybridHookWidgets |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* Yes, we're localizing the plugin. This partly makes sure non-English |
|
30 |
* users can use it too. To translate into your language use the |
|
31 |
* en_EN.po file as as guide. Poedit is a good tool to for translating. |
|
32 |
* @link http://poedit.net |
|
33 |
* |
|
34 |
* @since 0.1 |
|
35 |
*/ |
|
36 |
load_plugin_textdomain( 'hook_widgets', false, '/hybrid-hook-widgets' ); |
|
37 |
|
|
38 |
/** |
|
39 |
* Add functions to action hooks available in WP and Hybrid. |
|
40 |
* @since 0.1 |
|
41 |
*/ |
|
42 |
add_action( 'init', 'hook_widgets_register' ); |
|
43 |
add_action( 'hybrid_before_html', 'hook_widgets_before_html', 11 ); |
|
44 |
add_action( 'hybrid_after_html', 'hook_widgets_after_html', 11 ); |
|
45 |
add_action( 'hybrid_before_header', 'hook_widgets_before_header', 11 ); |
|
46 |
add_action( 'hybrid_header', 'hook_widgets_header', 11 ); |
|
47 |
add_action( 'hybrid_after_header', 'hook_widgets_after_header', 11 ); |
|
48 |
add_action( 'hybrid_before_container', 'hook_widgets_before_container', 11 ); |
|
49 |
add_action( 'hybrid_after_container', 'hook_widgets_after_container', 11 ); |
|
50 |
add_action( 'hybrid_before_footer', 'hook_widgets_before_footer', 11 ); |
|
51 |
add_action( 'hybrid_footer', 'hook_widgets_footer', 11 ); |
|
52 |
add_action( 'hybrid_after_footer', 'hook_widgets_after_footer', 11 ); |
|
53 |
add_action( 'comment_form', 'hook_widgets_comment_form', 11 ); |
|
54 |
|
|
55 |
/** |
|
56 |
* Create the additional widget areas for the plugin. |
|
57 |
* @uses register_sidebar() Creates new widget areas. |
|
58 |
* |
|
59 |
* @since 0.1 |
|
60 |
*/ |
|
61 |
function hook_widgets_register() { |
|
62 |
register_sidebar( array( 'name' => __('Hook: Before HTML ', 'hook_widgets'), 'id' => 'hook-before-html', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
63 |
register_sidebar( array( 'name' => __('Hook: After HTML', 'hook_widgets'), 'id' => 'hook-after-html', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
64 |
register_sidebar( array( 'name' => __('Hook: Before Header', 'hook_widgets'), 'id' => 'hook-before-header', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
65 |
register_sidebar( array( 'name' => __('Hook: Header', 'hook_widgets'), 'id' => 'hook-header', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
66 |
register_sidebar( array( 'name' => __('Hook: After Header', 'hook_widgets'), 'id' => 'hook-after-header', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
67 |
register_sidebar( array( 'name' => __('Hook: Before Container', 'hook_widgets'), 'id' => 'hook-before-container', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
68 |
register_sidebar( array( 'name' => __('Hook: After Container', 'hook_widgets'), 'id' => 'hook-after-container', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
69 |
register_sidebar( array( 'name' => __('Hook: Before Footer', 'hook_widgets'), 'id' => 'hook-before-footer', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
70 |
register_sidebar( array( 'name' => __('Hook: Footer', 'hook_widgets'), 'id' => 'hook-footer', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
71 |
register_sidebar( array( 'name' => __('Hook: After Footer', 'hook_widgets'), 'id' => 'hook-after-footer', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
72 |
register_sidebar( array( 'name' => __('Hook: Comment Form', 'hook_widgets'), 'id' => 'hook-comment-form', 'before_widget' => '<div id="%1$s" class="widget %2$s widget-%2$s"><div class="widget-inside">', 'after_widget' => '</div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Output the Before HTML widget area. |
|
77 |
* @since 0.1 |
|
78 |
*/ |
|
79 |
function hook_widgets_before_html() { |
|
80 |
if ( !is_active_sidebar( 'hook-before-html' ) ) |
|
81 |
return; |
|
82 |
|
|
83 |
echo '<div id="utility-before-html" class="utility utility-before-html">'; |
|
84 |
dynamic_sidebar( 'hook-before-html' ); |
|
85 |
echo '</div>'; |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Output the After HTML widget area. |
|
90 |
* @since 0.1 |
|
91 |
*/ |
|
92 |
function hook_widgets_after_html() { |
|
93 |
if ( !is_active_sidebar( 'hook-after-html' ) ) |
|
94 |
return; |
|
95 |
|
|
96 |
echo '<div id="utility-after-html" class="utility utility-after-html">'; |
|
97 |
dynamic_sidebar( 'hook-after-html' ); |
|
98 |
echo '</div>'; |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* Output the Before Header widget area. |
|
103 |
* @since 0.1 |
|
104 |
*/ |
|
105 |
function hook_widgets_before_header() { |
|
106 |
if ( !is_active_sidebar( 'hook-before-header' ) ) |
|
107 |
return; |
|
108 |
|
|
109 |
echo '<div id="utility-before-header" class="utility utility-before-header">'; |
|
110 |
dynamic_sidebar( 'hook-before-header' ); |
|
111 |
echo '</div>'; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Output the Header widget area. |
|
116 |
* @since 0.1 |
|
117 |
*/ |
|
118 |
function hook_widgets_header() { |
|
119 |
if ( !is_active_sidebar( 'hook-header' ) ) |
|
120 |
return; |
|
121 |
|
|
122 |
echo '<div id="utility-header" class="utility utility-header">'; |
|
123 |
dynamic_sidebar( 'hook-header' ); |
|
124 |
echo '</div>'; |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* Output the After Header widget area. |
|
129 |
* @since 0.1 |
|
130 |
*/ |
|
131 |
function hook_widgets_after_header() { |
|
132 |
if ( !is_active_sidebar( 'hook-after-header' ) ) |
|
133 |
return; |
|
134 |
|
|
135 |
echo '<div id="utility-after-header" class="utility utility-after-header">'; |
|
136 |
dynamic_sidebar( 'hook-after-header' ); |
|
137 |
echo '</div>'; |
|
138 |
} |
|
139 |
|
|
140 |
/** |
|
141 |
* Output the Before Container widget area. |
|
142 |
* @since 0.1 |
|
143 |
*/ |
|
144 |
function hook_widgets_before_container() { |
|
145 |
if ( !is_active_sidebar( 'hook-before-container' ) ) |
|
146 |
return; |
|
147 |
|
|
148 |
echo '<div id="utility-before-container" class="utility utility-before-container">'; |
|
149 |
dynamic_sidebar( 'hook-before-container' ); |
|
150 |
echo '</div>'; |
|
151 |
} |
|
152 |
|
|
153 |
/** |
|
154 |
* Output the After Container widget area. |
|
155 |
* @since 0.1 |
|
156 |
*/ |
|
157 |
function hook_widgets_after_container() { |
|
158 |
if ( !is_active_sidebar( 'hook-after-container' ) ) |
|
159 |
return; |
|
160 |
|
|
161 |
echo '<div id="utility-after-container" class="utility utility-after-container">'; |
|
162 |
dynamic_sidebar( 'hook-after-container' ); |
|
163 |
echo '</div>'; |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* Output the Before Footer widget area. |
|
168 |
* @since 0.1 |
|
169 |
*/ |
|
170 |
function hook_widgets_before_footer() { |
|
171 |
if ( !is_active_sidebar( 'hook-before-footer' ) ) |
|
172 |
return; |
|
173 |
|
|
174 |
echo '<div id="utility-before-footer" class="utility utility-before-footer">'; |
|
175 |
dynamic_sidebar( 'hook-before-footer' ); |
|
176 |
echo '</div>'; |
|
177 |
} |
|
178 |
|
|
179 |
/** |
|
180 |
* Output the Footer widget area. |
|
181 |
* @since 0.1 |
|
182 |
*/ |
|
183 |
function hook_widgets_footer() { |
|
184 |
if ( !is_active_sidebar( 'hook-footer' ) ) |
|
185 |
return; |
|
186 |
|
|
187 |
echo '<div id="utility-footer" class="utility utility-footer">'; |
|
188 |
dynamic_sidebar( 'hook-footer' ); |
|
189 |
echo '</div>'; |
|
190 |
} |
|
191 |
|
|
192 |
/** |
|
193 |
* Output the After Footer widget area. |
|
194 |
* @since 0.1 |
|
195 |
*/ |
|
196 |
function hook_widgets_after_footer() { |
|
197 |
if ( !is_active_sidebar( 'hook-after-footer' ) ) |
|
198 |
return; |
|
199 |
|
|
200 |
echo '<div id="utility-after-footer" class="utility utility-after-footer">'; |
|
201 |
dynamic_sidebar( 'hook-after-footer' ); |
|
202 |
echo '</div>'; |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* Output the Comment Form widget area. |
|
207 |
* @since 0.1 |
|
208 |
*/ |
|
209 |
function hook_widgets_comment_form() { |
|
210 |
if ( !is_active_sidebar( 'hook-comment-form' ) ) |
|
211 |
return; |
|
212 |
|
|
213 |
echo '<div id="utility-comment-form" class="utility utility-comment-form">'; |
|
214 |
dynamic_sidebar( 'hook-comment-form' ); |
|
215 |
echo '</div>'; |
|
216 |
} |
|
217 |
|
|
218 |
?> |