5
5
* For more information on hooks, actions, and filters, see https://codex.wordpress.org/Plugin_API.
6
6
*/
7
7
8
- require_once ( 'functions.jquery.php ' ) ;
8
+ require_once 'functions.jquery.php ' ;
9
9
10
10
/**
11
11
* Set the content width based on the theme's design and stylesheet.
12
12
*/
13
- if ( ! isset ( $ content_width ) )
13
+ if ( !isset ( $ content_width ) ) {
14
14
$ content_width = 584 ;
15
+ }
15
16
16
- /**
17
- * Tell WordPress to run twentyeleven_setup() when the 'after_setup_theme' hook is run.
18
- */
19
- add_action ( 'after_setup_theme ' , 'twentyeleven_setup ' );
20
-
21
- if ( ! function_exists ( 'twentyeleven_setup ' ) ):
22
- /**
23
- * Sets up theme defaults and registers support for various WordPress features.
24
- */
25
- function twentyeleven_setup () {
17
+ add_action ( 'after_setup_theme ' , function () {
26
18
// This theme styles the visual editor with editor-style.css to match the theme style.
27
19
add_editor_style ();
28
20
@@ -31,55 +23,38 @@ function twentyeleven_setup() {
31
23
32
24
// This theme uses wp_nav_menu() in one location.
33
25
register_nav_menu ( 'primary ' , __ ( 'Primary Menu ' , 'twentyeleven ' ) );
34
- }
35
- endif ; // twentyeleven_setup
26
+ } );
36
27
37
28
/**
38
29
* Returns a "Continue Reading" link for excerpts
39
30
*/
40
- function twentyeleven_continue_reading_link () {
31
+ function jq_continue_reading_link () {
41
32
return ' <a href=" ' . esc_url ( get_permalink () ) . '"> ' . __ ( 'Continue reading <span class="meta-nav">→</span> ' , 'twentyeleven ' ) . '</a> ' ;
42
33
}
43
34
44
35
/**
45
- * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link().
36
+ * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis
37
+ * and jq_continue_reading_link().
46
38
*
47
39
* To override this in a child theme, remove the filter and add your own
48
40
* function tied to the excerpt_more filter hook.
49
41
*/
50
- function twentyeleven_auto_excerpt_more ( $ more ) {
51
- return ' … ' . twentyeleven_continue_reading_link ();
52
- }
53
- add_filter ( 'excerpt_more ' , 'twentyeleven_auto_excerpt_more ' );
54
-
55
- /**
56
- * Adds a pretty "Continue Reading" link to custom post excerpts.
57
- *
58
- * To override this link in a child theme, remove the filter and add your own
59
- * function tied to the get_the_excerpt filter hook.
60
- */
61
- function twentyeleven_custom_excerpt_more ( $ output ) {
62
- if ( has_excerpt () && ! is_attachment () ) {
63
- $ output .= twentyeleven_continue_reading_link ();
64
- }
65
- return $ output ;
66
- }
67
- // add_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
42
+ add_filter ( 'excerpt_more ' , function ( $ more ) {
43
+ return ' … ' . jq_continue_reading_link ();
44
+ } );
68
45
69
46
/**
70
47
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
71
48
*/
72
- function twentyeleven_page_menu_args ( $ args ) {
49
+ add_filter ( ' wp_page_menu_args ' , function ( $ args ) {
73
50
$ args ['show_home ' ] = true ;
74
51
return $ args ;
75
- }
76
- add_filter ( 'wp_page_menu_args ' , 'twentyeleven_page_menu_args ' );
52
+ } );
77
53
78
54
/**
79
55
* Register our sidebars and widgetized areas. Also register the default Epherma widget.
80
56
*/
81
- function twentyeleven_widgets_init () {
82
-
57
+ add_action ( 'widgets_init ' , function () {
83
58
register_sidebar ( array (
84
59
'name ' => __ ( 'Main Sidebar ' , 'twentyeleven ' ),
85
60
'id ' => 'sidebar-1 ' ,
@@ -128,28 +103,12 @@ function twentyeleven_widgets_init() {
128
103
'before_title ' => '<h3 class="widget-title"> ' ,
129
104
'after_title ' => '</h3> ' ,
130
105
) );
131
- }
132
- add_action ( 'widgets_init ' , 'twentyeleven_widgets_init ' );
133
-
134
- /**
135
- * Display navigation to next/previous pages when applicable
136
- */
137
- function twentyeleven_content_nav ( $ nav_id ) {
138
- global $ wp_query ;
139
-
140
- if ( $ wp_query ->max_num_pages > 1 ) : ?>
141
- <nav id="<?php echo $ nav_id ; ?> ">
142
- <h3 class="assistive-text"><?php _e ( 'Post navigation ' , 'twentyeleven ' ); ?> </h3>
143
- <div class="nav-previous"><?php next_posts_link ( __ ( '<span class="meta-nav">←</span> Older posts ' , 'twentyeleven ' ) ); ?> </div>
144
- <div class="nav-next"><?php previous_posts_link ( __ ( 'Newer posts <span class="meta-nav">→</span> ' , 'twentyeleven ' ) ); ?> </div>
145
- </nav><!-- #nav-above -->
146
- <?php endif ;
147
- }
106
+ } );
148
107
149
108
/**
150
109
* Count the number of footer sidebars to enable dynamic classes for the footer
151
110
*/
152
- function twentyeleven_footer_sidebar_class () {
111
+ function jq_footer_sidebar_class () {
153
112
$ count = 0 ;
154
113
155
114
if ( is_active_sidebar ( 'sidebar-3 ' ) )
@@ -179,16 +138,15 @@ function twentyeleven_footer_sidebar_class() {
179
138
echo 'class=" ' . $ class . '" ' ;
180
139
}
181
140
182
- if ( ! function_exists ( 'twentyeleven_comment ' ) ) :
183
141
/**
184
142
* Template for comments and pingbacks.
185
143
*
186
144
* To override this walker in a child theme without modifying the comments template
187
- * simply create your own twentyeleven_comment (), and that function will be used instead.
145
+ * simply create your own jq_comment (), and that function will be used instead.
188
146
*
189
147
* Used as a callback by wp_list_comments() for displaying the comments.
190
148
*/
191
- function twentyeleven_comment ( $ comment , $ args , $ depth ) {
149
+ function jq_comment ( $ comment , $ args , $ depth ) {
192
150
$ GLOBALS ['comment ' ] = $ comment ;
193
151
switch ( $ comment ->comment_type ) :
194
152
case 'pingback ' :
@@ -241,14 +199,12 @@ function twentyeleven_comment( $comment, $args, $depth ) {
241
199
break ;
242
200
endswitch ;
243
201
}
244
- endif ; // ends check for twentyeleven_comment()
245
202
246
- if ( ! function_exists ( 'twentyeleven_posted_on ' ) ) :
247
203
/**
248
204
* Prints HTML with meta information for the current post-date/time and author.
249
- * Create your own twentyeleven_posted_on to override in a child theme
205
+ * Create your own jq_posted_on to override in a child theme
250
206
*/
251
- function twentyeleven_posted_on () {
207
+ function jq_posted_on () {
252
208
printf ( __ ( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span> ' , 'twentyeleven ' ),
253
209
esc_url ( get_permalink () ),
254
210
esc_attr ( get_the_time () ),
@@ -259,14 +215,13 @@ function twentyeleven_posted_on() {
259
215
esc_html ( get_the_author () )
260
216
);
261
217
}
262
- endif ;
263
218
264
219
/**
265
220
* Adds two classes to the array of body classes.
266
221
* The first is if the site has only had one author with published posts.
267
222
* The second is if a singular post being displayed
268
223
*/
269
- function twentyeleven_body_classes ( $ classes ) {
224
+ add_filter ( ' body_class ' , function ( $ classes ) {
270
225
271
226
if ( ! is_multi_author () ) {
272
227
$ classes [] = 'single-author ' ;
@@ -276,5 +231,4 @@ function twentyeleven_body_classes( $classes ) {
276
231
$ classes [] = 'singular ' ;
277
232
278
233
return $ classes ;
279
- }
280
- add_filter ( 'body_class ' , 'twentyeleven_body_classes ' );
234
+ } );
0 commit comments