1 <?php |
|
2 /** |
|
3 * Twenty Fourteen functions and definitions |
|
4 * |
|
5 * Set up the theme and provides some helper functions, which are used in the |
|
6 * theme as custom template tags. Others are attached to action and filter |
|
7 * hooks in WordPress to change core functionality. |
|
8 * |
|
9 * When using a child theme you can override certain functions (those wrapped |
|
10 * in a function_exists() call) by defining them first in your child theme's |
|
11 * functions.php file. The child theme's functions.php file is included before |
|
12 * the parent theme's file, so the child theme functions would be used. |
|
13 * |
|
14 * @link https://codex.wordpress.org/Theme_Development |
|
15 * @link https://codex.wordpress.org/Child_Themes |
|
16 * |
|
17 * Functions that are not pluggable (not wrapped in function_exists()) are |
|
18 * instead attached to a filter or action hook. |
|
19 * |
|
20 * For more information on hooks, actions, and filters, |
|
21 * @link https://codex.wordpress.org/Plugin_API |
|
22 * |
|
23 * @package WordPress |
|
24 * @subpackage Twenty_Fourteen |
|
25 * @since Twenty Fourteen 1.0 |
|
26 */ |
|
27 |
|
28 /** |
|
29 * Set up the content width value based on the theme's design. |
|
30 * |
|
31 * @see twentyfourteen_content_width() |
|
32 * |
|
33 * @since Twenty Fourteen 1.0 |
|
34 */ |
|
35 if ( ! isset( $content_width ) ) { |
|
36 $content_width = 474; |
|
37 } |
|
38 |
|
39 /** |
|
40 * Twenty Fourteen only works in WordPress 3.6 or later. |
|
41 */ |
|
42 if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) { |
|
43 require get_template_directory() . '/inc/back-compat.php'; |
|
44 } |
|
45 |
|
46 if ( ! function_exists( 'twentyfourteen_setup' ) ) : |
|
47 /** |
|
48 * Twenty Fourteen setup. |
|
49 * |
|
50 * Set up theme defaults and registers support for various WordPress features. |
|
51 * |
|
52 * Note that this function is hooked into the after_setup_theme hook, which |
|
53 * runs before the init hook. The init hook is too late for some features, such |
|
54 * as indicating support post thumbnails. |
|
55 * |
|
56 * @since Twenty Fourteen 1.0 |
|
57 */ |
|
58 function twentyfourteen_setup() { |
|
59 |
|
60 /* |
|
61 * Make Twenty Fourteen available for translation. |
|
62 * |
|
63 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyfourteen |
|
64 * If you're building a theme based on Twenty Fourteen, use a find and |
|
65 * replace to change 'twentyfourteen' to the name of your theme in all |
|
66 * template files. |
|
67 */ |
|
68 load_theme_textdomain( 'twentyfourteen' ); |
|
69 |
|
70 // This theme styles the visual editor to resemble the theme style. |
|
71 add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) ); |
|
72 |
|
73 // Add RSS feed links to <head> for posts and comments. |
|
74 add_theme_support( 'automatic-feed-links' ); |
|
75 |
|
76 // Enable support for Post Thumbnails, and declare two sizes. |
|
77 add_theme_support( 'post-thumbnails' ); |
|
78 set_post_thumbnail_size( 672, 372, true ); |
|
79 add_image_size( 'twentyfourteen-full-width', 1038, 576, true ); |
|
80 |
|
81 // This theme uses wp_nav_menu() in two locations. |
|
82 register_nav_menus( |
|
83 array( |
|
84 'primary' => __( 'Top primary menu', 'twentyfourteen' ), |
|
85 'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ), |
|
86 ) |
|
87 ); |
|
88 |
|
89 /* |
|
90 * Switch default core markup for search form, comment form, and comments |
|
91 * to output valid HTML5. |
|
92 */ |
|
93 add_theme_support( |
|
94 'html5', array( |
|
95 'search-form', |
|
96 'comment-form', |
|
97 'comment-list', |
|
98 'gallery', |
|
99 'caption', |
|
100 ) |
|
101 ); |
|
102 |
|
103 /* |
|
104 * Enable support for Post Formats. |
|
105 * See https://codex.wordpress.org/Post_Formats |
|
106 */ |
|
107 add_theme_support( |
|
108 'post-formats', array( |
|
109 'aside', |
|
110 'image', |
|
111 'video', |
|
112 'audio', |
|
113 'quote', |
|
114 'link', |
|
115 'gallery', |
|
116 ) |
|
117 ); |
|
118 |
|
119 // This theme allows users to set a custom background. |
|
120 add_theme_support( |
|
121 'custom-background', apply_filters( |
|
122 'twentyfourteen_custom_background_args', array( |
|
123 'default-color' => 'f5f5f5', |
|
124 ) |
|
125 ) |
|
126 ); |
|
127 |
|
128 // Add support for featured content. |
|
129 add_theme_support( |
|
130 'featured-content', array( |
|
131 'featured_content_filter' => 'twentyfourteen_get_featured_posts', |
|
132 'max_posts' => 6, |
|
133 ) |
|
134 ); |
|
135 |
|
136 // This theme uses its own gallery styles. |
|
137 add_filter( 'use_default_gallery_style', '__return_false' ); |
|
138 |
|
139 // Indicate widget sidebars can use selective refresh in the Customizer. |
|
140 add_theme_support( 'customize-selective-refresh-widgets' ); |
|
141 } |
|
142 endif; // twentyfourteen_setup |
|
143 add_action( 'after_setup_theme', 'twentyfourteen_setup' ); |
|
144 |
|
145 /** |
|
146 * Adjust content_width value for image attachment template. |
|
147 * |
|
148 * @since Twenty Fourteen 1.0 |
|
149 */ |
|
150 function twentyfourteen_content_width() { |
|
151 if ( is_attachment() && wp_attachment_is_image() ) { |
|
152 $GLOBALS['content_width'] = 810; |
|
153 } |
|
154 } |
|
155 add_action( 'template_redirect', 'twentyfourteen_content_width' ); |
|
156 |
|
157 /** |
|
158 * Getter function for Featured Content Plugin. |
|
159 * |
|
160 * @since Twenty Fourteen 1.0 |
|
161 * |
|
162 * @return array An array of WP_Post objects. |
|
163 */ |
|
164 function twentyfourteen_get_featured_posts() { |
|
165 /** |
|
166 * Filter the featured posts to return in Twenty Fourteen. |
|
167 * |
|
168 * @since Twenty Fourteen 1.0 |
|
169 * |
|
170 * @param array|bool $posts Array of featured posts, otherwise false. |
|
171 */ |
|
172 return apply_filters( 'twentyfourteen_get_featured_posts', array() ); |
|
173 } |
|
174 |
|
175 /** |
|
176 * A helper conditional function that returns a boolean value. |
|
177 * |
|
178 * @since Twenty Fourteen 1.0 |
|
179 * |
|
180 * @return bool Whether there are featured posts. |
|
181 */ |
|
182 function twentyfourteen_has_featured_posts() { |
|
183 return ! is_paged() && (bool) twentyfourteen_get_featured_posts(); |
|
184 } |
|
185 |
|
186 /** |
|
187 * Register three Twenty Fourteen widget areas. |
|
188 * |
|
189 * @since Twenty Fourteen 1.0 |
|
190 */ |
|
191 function twentyfourteen_widgets_init() { |
|
192 require get_template_directory() . '/inc/widgets.php'; |
|
193 register_widget( 'Twenty_Fourteen_Ephemera_Widget' ); |
|
194 |
|
195 register_sidebar( |
|
196 array( |
|
197 'name' => __( 'Primary Sidebar', 'twentyfourteen' ), |
|
198 'id' => 'sidebar-1', |
|
199 'description' => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ), |
|
200 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
201 'after_widget' => '</aside>', |
|
202 'before_title' => '<h1 class="widget-title">', |
|
203 'after_title' => '</h1>', |
|
204 ) |
|
205 ); |
|
206 register_sidebar( |
|
207 array( |
|
208 'name' => __( 'Content Sidebar', 'twentyfourteen' ), |
|
209 'id' => 'sidebar-2', |
|
210 'description' => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ), |
|
211 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
212 'after_widget' => '</aside>', |
|
213 'before_title' => '<h1 class="widget-title">', |
|
214 'after_title' => '</h1>', |
|
215 ) |
|
216 ); |
|
217 register_sidebar( |
|
218 array( |
|
219 'name' => __( 'Footer Widget Area', 'twentyfourteen' ), |
|
220 'id' => 'sidebar-3', |
|
221 'description' => __( 'Appears in the footer section of the site.', 'twentyfourteen' ), |
|
222 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
|
223 'after_widget' => '</aside>', |
|
224 'before_title' => '<h1 class="widget-title">', |
|
225 'after_title' => '</h1>', |
|
226 ) |
|
227 ); |
|
228 } |
|
229 add_action( 'widgets_init', 'twentyfourteen_widgets_init' ); |
|
230 |
|
231 /** |
|
232 * Register Lato Google font for Twenty Fourteen. |
|
233 * |
|
234 * @since Twenty Fourteen 1.0 |
|
235 * |
|
236 * @return string |
|
237 */ |
|
238 function twentyfourteen_font_url() { |
|
239 $font_url = ''; |
|
240 /* |
|
241 * Translators: If there are characters in your language that are not supported |
|
242 * by Lato, translate this to 'off'. Do not translate into your own language. |
|
243 */ |
|
244 if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { |
|
245 $query_args = array( |
|
246 'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), |
|
247 'subset' => urlencode( 'latin,latin-ext' ), |
|
248 ); |
|
249 $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); |
|
250 } |
|
251 |
|
252 return $font_url; |
|
253 } |
|
254 |
|
255 /** |
|
256 * Enqueue scripts and styles for the front end. |
|
257 * |
|
258 * @since Twenty Fourteen 1.0 |
|
259 */ |
|
260 function twentyfourteen_scripts() { |
|
261 // Add Lato font, used in the main stylesheet. |
|
262 wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); |
|
263 |
|
264 // Add Genericons font, used in the main stylesheet. |
|
265 wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); |
|
266 |
|
267 // Load our main stylesheet. |
|
268 wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri() ); |
|
269 |
|
270 // Load the Internet Explorer specific stylesheet. |
|
271 wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131205' ); |
|
272 wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); |
|
273 |
|
274 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
275 wp_enqueue_script( 'comment-reply' ); |
|
276 } |
|
277 |
|
278 if ( is_singular() && wp_attachment_is_image() ) { |
|
279 wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); |
|
280 } |
|
281 |
|
282 if ( is_active_sidebar( 'sidebar-3' ) ) { |
|
283 wp_enqueue_script( 'jquery-masonry' ); |
|
284 } |
|
285 |
|
286 if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { |
|
287 wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true ); |
|
288 wp_localize_script( |
|
289 'twentyfourteen-slider', 'featuredSliderDefaults', array( |
|
290 'prevText' => __( 'Previous', 'twentyfourteen' ), |
|
291 'nextText' => __( 'Next', 'twentyfourteen' ), |
|
292 ) |
|
293 ); |
|
294 } |
|
295 |
|
296 wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true ); |
|
297 } |
|
298 add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); |
|
299 |
|
300 /** |
|
301 * Enqueue Google fonts style to admin screen for custom header display. |
|
302 * |
|
303 * @since Twenty Fourteen 1.0 |
|
304 */ |
|
305 function twentyfourteen_admin_fonts() { |
|
306 wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null ); |
|
307 } |
|
308 add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' ); |
|
309 |
|
310 /** |
|
311 * Add preconnect for Google Fonts. |
|
312 * |
|
313 * @since Twenty Fourteen 1.9 |
|
314 * |
|
315 * @param array $urls URLs to print for resource hints. |
|
316 * @param string $relation_type The relation type the URLs are printed. |
|
317 * @return array URLs to print for resource hints. |
|
318 */ |
|
319 function twentyfourteen_resource_hints( $urls, $relation_type ) { |
|
320 if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) { |
|
321 if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { |
|
322 $urls[] = array( |
|
323 'href' => 'https://fonts.gstatic.com', |
|
324 'crossorigin', |
|
325 ); |
|
326 } else { |
|
327 $urls[] = 'https://fonts.gstatic.com'; |
|
328 } |
|
329 } |
|
330 |
|
331 return $urls; |
|
332 } |
|
333 add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 ); |
|
334 |
|
335 if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : |
|
336 /** |
|
337 * Print the attached image with a link to the next attached image. |
|
338 * |
|
339 * @since Twenty Fourteen 1.0 |
|
340 */ |
|
341 function twentyfourteen_the_attached_image() { |
|
342 $post = get_post(); |
|
343 /** |
|
344 * Filter the default Twenty Fourteen attachment size. |
|
345 * |
|
346 * @since Twenty Fourteen 1.0 |
|
347 * |
|
348 * @param array $dimensions { |
|
349 * An array of height and width dimensions. |
|
350 * |
|
351 * @type int $height Height of the image in pixels. Default 810. |
|
352 * @type int $width Width of the image in pixels. Default 810. |
|
353 * } |
|
354 */ |
|
355 $attachment_size = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) ); |
|
356 $next_attachment_url = wp_get_attachment_url(); |
|
357 |
|
358 /* |
|
359 * Grab the IDs of all the image attachments in a gallery so we can get the URL |
|
360 * of the next adjacent image in a gallery, or the first image (if we're |
|
361 * looking at the last image in a gallery), or, in a gallery of one, just the |
|
362 * link to that image file. |
|
363 */ |
|
364 $attachment_ids = get_posts( |
|
365 array( |
|
366 'post_parent' => $post->post_parent, |
|
367 'fields' => 'ids', |
|
368 'numberposts' => -1, |
|
369 'post_status' => 'inherit', |
|
370 'post_type' => 'attachment', |
|
371 'post_mime_type' => 'image', |
|
372 'order' => 'ASC', |
|
373 'orderby' => 'menu_order ID', |
|
374 ) |
|
375 ); |
|
376 |
|
377 // If there is more than 1 attachment in a gallery... |
|
378 if ( count( $attachment_ids ) > 1 ) { |
|
379 foreach ( $attachment_ids as $idx => $attachment_id ) { |
|
380 if ( $attachment_id == $post->ID ) { |
|
381 $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ]; |
|
382 break; |
|
383 } |
|
384 } |
|
385 |
|
386 // get the URL of the next image attachment... |
|
387 if ( $next_id ) { |
|
388 $next_attachment_url = get_attachment_link( $next_id ); |
|
389 } // or get the URL of the first image attachment. |
|
390 else { |
|
391 $next_attachment_url = get_attachment_link( reset( $attachment_ids ) ); |
|
392 } |
|
393 } |
|
394 |
|
395 printf( |
|
396 '<a href="%1$s" rel="attachment">%2$s</a>', |
|
397 esc_url( $next_attachment_url ), |
|
398 wp_get_attachment_image( $post->ID, $attachment_size ) |
|
399 ); |
|
400 } |
|
401 endif; |
|
402 |
|
403 if ( ! function_exists( 'twentyfourteen_list_authors' ) ) : |
|
404 /** |
|
405 * Print a list of all site contributors who published at least one post. |
|
406 * |
|
407 * @since Twenty Fourteen 1.0 |
|
408 */ |
|
409 function twentyfourteen_list_authors() { |
|
410 $contributor_ids = get_users( |
|
411 array( |
|
412 'fields' => 'ID', |
|
413 'orderby' => 'post_count', |
|
414 'order' => 'DESC', |
|
415 'who' => 'authors', |
|
416 ) |
|
417 ); |
|
418 |
|
419 foreach ( $contributor_ids as $contributor_id ) : |
|
420 $post_count = count_user_posts( $contributor_id ); |
|
421 |
|
422 // Move on if user has not published a post (yet). |
|
423 if ( ! $post_count ) { |
|
424 continue; |
|
425 } |
|
426 ?> |
|
427 |
|
428 <div class="contributor"> |
|
429 <div class="contributor-info"> |
|
430 <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div> |
|
431 <div class="contributor-summary"> |
|
432 <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2> |
|
433 <p class="contributor-bio"> |
|
434 <?php echo get_the_author_meta( 'description', $contributor_id ); ?> |
|
435 </p> |
|
436 <a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>"> |
|
437 <?php printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); ?> |
|
438 </a> |
|
439 </div><!-- .contributor-summary --> |
|
440 </div><!-- .contributor-info --> |
|
441 </div><!-- .contributor --> |
|
442 |
|
443 <?php |
|
444 endforeach; |
|
445 } |
|
446 endif; |
|
447 |
|
448 /** |
|
449 * Extend the default WordPress body classes. |
|
450 * |
|
451 * Adds body classes to denote: |
|
452 * 1. Single or multiple authors. |
|
453 * 2. Presence of header image except in Multisite signup and activate pages. |
|
454 * 3. Index views. |
|
455 * 4. Full-width content layout. |
|
456 * 5. Presence of footer widgets. |
|
457 * 6. Single views. |
|
458 * 7. Featured content layout. |
|
459 * |
|
460 * @since Twenty Fourteen 1.0 |
|
461 * |
|
462 * @param array $classes A list of existing body class values. |
|
463 * @return array The filtered body class list. |
|
464 */ |
|
465 function twentyfourteen_body_classes( $classes ) { |
|
466 if ( is_multi_author() ) { |
|
467 $classes[] = 'group-blog'; |
|
468 } |
|
469 |
|
470 if ( get_header_image() ) { |
|
471 $classes[] = 'header-image'; |
|
472 } elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) { |
|
473 $classes[] = 'masthead-fixed'; |
|
474 } |
|
475 |
|
476 if ( is_archive() || is_search() || is_home() ) { |
|
477 $classes[] = 'list-view'; |
|
478 } |
|
479 |
|
480 if ( ( ! is_active_sidebar( 'sidebar-2' ) ) |
|
481 || is_page_template( 'page-templates/full-width.php' ) |
|
482 || is_page_template( 'page-templates/contributors.php' ) |
|
483 || is_attachment() ) { |
|
484 $classes[] = 'full-width'; |
|
485 } |
|
486 |
|
487 if ( is_active_sidebar( 'sidebar-3' ) ) { |
|
488 $classes[] = 'footer-widgets'; |
|
489 } |
|
490 |
|
491 if ( is_singular() && ! is_front_page() ) { |
|
492 $classes[] = 'singular'; |
|
493 } |
|
494 |
|
495 if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { |
|
496 $classes[] = 'slider'; |
|
497 } elseif ( is_front_page() ) { |
|
498 $classes[] = 'grid'; |
|
499 } |
|
500 |
|
501 return $classes; |
|
502 } |
|
503 add_filter( 'body_class', 'twentyfourteen_body_classes' ); |
|
504 |
|
505 /** |
|
506 * Extend the default WordPress post classes. |
|
507 * |
|
508 * Adds a post class to denote: |
|
509 * Non-password protected page with a post thumbnail. |
|
510 * |
|
511 * @since Twenty Fourteen 1.0 |
|
512 * |
|
513 * @param array $classes A list of existing post class values. |
|
514 * @return array The filtered post class list. |
|
515 */ |
|
516 function twentyfourteen_post_classes( $classes ) { |
|
517 if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) { |
|
518 $classes[] = 'has-post-thumbnail'; |
|
519 } |
|
520 |
|
521 return $classes; |
|
522 } |
|
523 add_filter( 'post_class', 'twentyfourteen_post_classes' ); |
|
524 |
|
525 /** |
|
526 * Create a nicely formatted and more specific title element text for output |
|
527 * in head of document, based on current view. |
|
528 * |
|
529 * @since Twenty Fourteen 1.0 |
|
530 * |
|
531 * @global int $paged WordPress archive pagination page count. |
|
532 * @global int $page WordPress paginated post page count. |
|
533 * |
|
534 * @param string $title Default title text for current view. |
|
535 * @param string $sep Optional separator. |
|
536 * @return string The filtered title. |
|
537 */ |
|
538 function twentyfourteen_wp_title( $title, $sep ) { |
|
539 global $paged, $page; |
|
540 |
|
541 if ( is_feed() ) { |
|
542 return $title; |
|
543 } |
|
544 |
|
545 // Add the site name. |
|
546 $title .= get_bloginfo( 'name', 'display' ); |
|
547 |
|
548 // Add the site description for the home/front page. |
|
549 $site_description = get_bloginfo( 'description', 'display' ); |
|
550 if ( $site_description && ( is_home() || is_front_page() ) ) { |
|
551 $title = "$title $sep $site_description"; |
|
552 } |
|
553 |
|
554 // Add a page number if necessary. |
|
555 if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { |
|
556 $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); |
|
557 } |
|
558 |
|
559 return $title; |
|
560 } |
|
561 add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 ); |
|
562 |
|
563 |
|
564 /** |
|
565 * Modifies tag cloud widget arguments to display all tags in the same font size |
|
566 * and use list format for better accessibility. |
|
567 * |
|
568 * @since Twenty Fourteen 2.1 |
|
569 * |
|
570 * @param array $args Arguments for tag cloud widget. |
|
571 * @return array The filtered arguments for tag cloud widget. |
|
572 */ |
|
573 function twentyfourteen_widget_tag_cloud_args( $args ) { |
|
574 $args['largest'] = 22; |
|
575 $args['smallest'] = 8; |
|
576 $args['unit'] = 'pt'; |
|
577 $args['format'] = 'list'; |
|
578 |
|
579 return $args; |
|
580 } |
|
581 add_filter( 'widget_tag_cloud_args', 'twentyfourteen_widget_tag_cloud_args' ); |
|
582 |
|
583 |
|
584 // Implement Custom Header features. |
|
585 require get_template_directory() . '/inc/custom-header.php'; |
|
586 |
|
587 // Custom template tags for this theme. |
|
588 require get_template_directory() . '/inc/template-tags.php'; |
|
589 |
|
590 // Add Customizer functionality. |
|
591 require get_template_directory() . '/inc/customizer.php'; |
|
592 |
|
593 /* |
|
594 * Add Featured Content functionality. |
|
595 * |
|
596 * To overwrite in a plugin, define your own Featured_Content class on or |
|
597 * before the 'setup_theme' hook. |
|
598 */ |
|
599 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { |
|
600 require get_template_directory() . '/inc/featured-content.php'; |
|
601 } |
|
602 |
|
603 /** |
|
604 * Add an `is_customize_preview` function if it is missing. |
|
605 * |
|
606 * Enables installing Twenty Fourteen in WordPress versions before 4.0.0 when the |
|
607 * `is_customize_preview` function was introduced. |
|
608 */ |
|
609 if ( ! function_exists( 'is_customize_preview' ) ) : |
|
610 function is_customize_preview() { |
|
611 global $wp_customize; |
|
612 |
|
613 return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview(); |
|
614 } |
|
615 endif; |
|