| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Twenty Fourteen functions and definitions 4 * 5 * Sets 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://developer.wordpress.org/themes/basics/theme-functions/ 15 * @link https://developer.wordpress.org/themes/advanced-topics/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://developer.wordpress.org/plugins/ 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 * Manual loading of text domain is not required after the introduction of 69 * just in time translation loading in WordPress version 4.6. 70 * 71 * @ticket 58318 72 */ 73 if ( version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ) { 74 load_theme_textdomain( 'twentyfourteen' ); 75 } 76 77 /* 78 * This theme styles the visual editor to resemble the theme style. 79 * When fonts are self-hosted, the theme directory needs to be removed first. 80 */ 81 $font_stylesheet = str_replace( 82 array( get_template_directory_uri() . '/', get_stylesheet_directory_uri() . '/' ), 83 '', 84 (string) twentyfourteen_font_url() 85 ); 86 add_editor_style( array( 'css/editor-style.css', $font_stylesheet, 'genericons/genericons.css' ) ); 87 88 // Load regular editor styles into the new block-based editor. 89 add_theme_support( 'editor-styles' ); 90 91 // Load default block styles. 92 add_theme_support( 'wp-block-styles' ); 93 94 // Add support for responsive embeds. 95 add_theme_support( 'responsive-embeds' ); 96 97 // Add support for custom color scheme. 98 add_theme_support( 99 'editor-color-palette', 100 array( 101 array( 102 'name' => __( 'Green', 'twentyfourteen' ), 103 'slug' => 'green', 104 'color' => '#24890d', 105 ), 106 array( 107 'name' => __( 'Black', 'twentyfourteen' ), 108 'slug' => 'black', 109 'color' => '#000', 110 ), 111 array( 112 'name' => __( 'Dark Gray', 'twentyfourteen' ), 113 'slug' => 'dark-gray', 114 'color' => '#2b2b2b', 115 ), 116 array( 117 'name' => __( 'Medium Gray', 'twentyfourteen' ), 118 'slug' => 'medium-gray', 119 'color' => '#767676', 120 ), 121 array( 122 'name' => __( 'Light Gray', 'twentyfourteen' ), 123 'slug' => 'light-gray', 124 'color' => '#f5f5f5', 125 ), 126 array( 127 'name' => __( 'White', 'twentyfourteen' ), 128 'slug' => 'white', 129 'color' => '#fff', 130 ), 131 ) 132 ); 133 134 // Add RSS feed links to <head> for posts and comments. 135 add_theme_support( 'automatic-feed-links' ); 136 137 // Enable support for Post Thumbnails, and declare two sizes. 138 add_theme_support( 'post-thumbnails' ); 139 set_post_thumbnail_size( 672, 372, true ); 140 add_image_size( 'twentyfourteen-full-width', 1038, 576, true ); 141 142 // This theme uses wp_nav_menu() in two locations. 143 register_nav_menus( 144 array( 145 'primary' => __( 'Top primary menu', 'twentyfourteen' ), 146 'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ), 147 ) 148 ); 149 150 /* 151 * Switch default core markup for search form, comment form, and comments 152 * to output valid HTML5. 153 */ 154 add_theme_support( 155 'html5', 156 array( 157 'search-form', 158 'comment-form', 159 'comment-list', 160 'gallery', 161 'caption', 162 'script', 163 'style', 164 'navigation-widgets', 165 ) 166 ); 167 168 /* 169 * Enable support for Post Formats. 170 * See: https://developer.wordpress.org/advanced-administration/wordpress/post-formats/ 171 */ 172 add_theme_support( 173 'post-formats', 174 array( 175 'aside', 176 'image', 177 'video', 178 'audio', 179 'quote', 180 'link', 181 'gallery', 182 ) 183 ); 184 185 // This theme allows users to set a custom background. 186 add_theme_support( 187 'custom-background', 188 /** 189 * Filters Twenty Fourteen custom-background support arguments. 190 * 191 * @since Twenty Fourteen 1.0 192 * 193 * @param array $args { 194 * An array of custom-background support arguments. 195 * 196 * @type string $default-color Default color of the background. 197 * } 198 */ 199 apply_filters( 200 'twentyfourteen_custom_background_args', 201 array( 202 'default-color' => 'f5f5f5', 203 ) 204 ) 205 ); 206 207 // Add support for featured content. 208 add_theme_support( 209 'featured-content', 210 array( 211 'featured_content_filter' => 'twentyfourteen_get_featured_posts', 212 'max_posts' => 6, 213 ) 214 ); 215 216 // This theme uses its own gallery styles. 217 add_filter( 'use_default_gallery_style', '__return_false' ); 218 219 // Indicate widget sidebars can use selective refresh in the Customizer. 220 add_theme_support( 'customize-selective-refresh-widgets' ); 221 } 222 endif; // twentyfourteen_setup() 223 add_action( 'after_setup_theme', 'twentyfourteen_setup' ); 224 225 /** 226 * Adjusts content_width value for image attachment template. 227 * 228 * @since Twenty Fourteen 1.0 229 */ 230 function twentyfourteen_content_width() { 231 if ( is_attachment() && wp_attachment_is_image() ) { 232 $GLOBALS['content_width'] = 810; 233 } 234 } 235 add_action( 'template_redirect', 'twentyfourteen_content_width' ); 236 237 /** 238 * Getter function for Featured Content Plugin. 239 * 240 * @since Twenty Fourteen 1.0 241 * 242 * @return array An array of WP_Post objects. 243 */ 244 function twentyfourteen_get_featured_posts() { 245 /** 246 * Filters the featured posts to return in Twenty Fourteen. 247 * 248 * @since Twenty Fourteen 1.0 249 * 250 * @param array|bool $posts Array of featured posts, otherwise false. 251 */ 252 return apply_filters( 'twentyfourteen_get_featured_posts', array() ); 253 } 254 255 /** 256 * A helper conditional function that returns a boolean value. 257 * 258 * @since Twenty Fourteen 1.0 259 * 260 * @return bool Whether there are featured posts. 261 */ 262 function twentyfourteen_has_featured_posts() { 263 return ! is_paged() && (bool) twentyfourteen_get_featured_posts(); 264 } 265 266 /** 267 * Registers three Twenty Fourteen widget areas. 268 * 269 * @since Twenty Fourteen 1.0 270 */ 271 function twentyfourteen_widgets_init() { 272 require get_template_directory() . '/inc/widgets.php'; 273 register_widget( 'Twenty_Fourteen_Ephemera_Widget' ); 274 275 register_sidebar( 276 array( 277 'name' => __( 'Primary Sidebar', 'twentyfourteen' ), 278 'id' => 'sidebar-1', 279 'description' => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ), 280 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 281 'after_widget' => '</aside>', 282 'before_title' => '<h1 class="widget-title">', 283 'after_title' => '</h1>', 284 ) 285 ); 286 register_sidebar( 287 array( 288 'name' => __( 'Content Sidebar', 'twentyfourteen' ), 289 'id' => 'sidebar-2', 290 'description' => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ), 291 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 292 'after_widget' => '</aside>', 293 'before_title' => '<h1 class="widget-title">', 294 'after_title' => '</h1>', 295 ) 296 ); 297 register_sidebar( 298 array( 299 'name' => __( 'Footer Widget Area', 'twentyfourteen' ), 300 'id' => 'sidebar-3', 301 'description' => __( 'Appears in the footer section of the site.', 'twentyfourteen' ), 302 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 303 'after_widget' => '</aside>', 304 'before_title' => '<h1 class="widget-title">', 305 'after_title' => '</h1>', 306 ) 307 ); 308 } 309 add_action( 'widgets_init', 'twentyfourteen_widgets_init' ); 310 311 if ( ! function_exists( 'twentyfourteen_font_url' ) ) : 312 /** 313 * Registers Lato font for Twenty Fourteen. 314 * 315 * @since Twenty Fourteen 1.0 316 * @since Twenty Fourteen 3.6 Replaced Google URL with self-hosted fonts. 317 * 318 * @return string 319 */ 320 function twentyfourteen_font_url() { 321 $font_url = ''; 322 /* 323 * translators: If there are characters in your language that are not supported 324 * by Lato, translate this to 'off'. Do not translate into your own language. 325 */ 326 if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) { 327 $font_url = get_template_directory_uri() . '/fonts/font-lato.css'; 328 } 329 330 return $font_url; 331 } 332 endif; 333 334 /** 335 * Enqueues scripts and styles for the front end. 336 * 337 * @since Twenty Fourteen 1.0 338 */ 339 function twentyfourteen_scripts() { 340 // Add Lato font, used in the main stylesheet. 341 $font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 342 wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), $font_version ); 343 344 // Add Genericons font, used in the main stylesheet. 345 wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); 346 347 // Load our main stylesheet. 348 wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri(), array(), '20250715' ); 349 350 // Theme block stylesheet. 351 wp_enqueue_style( 'twentyfourteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentyfourteen-style' ), '20250715' ); 352 353 // Register the Internet Explorer specific stylesheet. 354 wp_register_style( 'twentyfourteen-ie', false, array( 'twentyfourteen-style' ) ); 355 356 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 357 wp_enqueue_script( 'comment-reply' ); 358 } 359 360 if ( is_singular() && wp_attachment_is_image() ) { 361 wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20150120' ); 362 } 363 364 if ( is_active_sidebar( 'sidebar-3' ) ) { 365 wp_enqueue_script( 'jquery-masonry' ); 366 } 367 368 if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) { 369 wp_enqueue_script( 370 'twentyfourteen-slider', 371 get_template_directory_uri() . '/js/slider.js', 372 array( 'jquery' ), 373 '20150120', 374 array( 375 'in_footer' => false, // Because involves header. 376 'strategy' => 'defer', 377 ) 378 ); 379 wp_localize_script( 380 'twentyfourteen-slider', 381 'featuredSliderDefaults', 382 array( 383 'prevText' => __( 'Previous', 'twentyfourteen' ), 384 'nextText' => __( 'Next', 'twentyfourteen' ), 385 ) 386 ); 387 } 388 389 wp_enqueue_script( 390 'twentyfourteen-script', 391 get_template_directory_uri() . '/js/functions.js', 392 array( 'jquery' ), 393 '20230526', 394 array( 395 'in_footer' => false, // Because involves header. 396 'strategy' => 'defer', 397 ) 398 ); 399 } 400 add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); 401 402 /** 403 * Enqueues font stylesheet to admin screen for custom header display. 404 * 405 * @since Twenty Fourteen 1.0 406 */ 407 function twentyfourteen_admin_fonts() { 408 $font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 409 wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), $font_version ); 410 } 411 add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' ); 412 413 /** 414 * Adds preconnect for Google Fonts. 415 * 416 * @since Twenty Fourteen 1.9 417 * @deprecated Twenty Fourteen 3.6 Disabled filter because, by default, fonts are self-hosted. 418 * 419 * @param array $urls URLs to print for resource hints. 420 * @param string $relation_type The relation type the URLs are printed. 421 * @return array URLs to print for resource hints. 422 */ 423 function twentyfourteen_resource_hints( $urls, $relation_type ) { 424 if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) { 425 if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { 426 $urls[] = array( 427 'href' => 'https://fonts.gstatic.com', 428 'crossorigin', 429 ); 430 } else { 431 $urls[] = 'https://fonts.gstatic.com'; 432 } 433 } 434 435 return $urls; 436 } 437 // add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 ); 438 439 /** 440 * Enqueues styles for the block-based editor. 441 * 442 * @since Twenty Fourteen 2.3 443 */ 444 function twentyfourteen_block_editor_styles() { 445 // Block styles. 446 wp_enqueue_style( 'twentyfourteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20240716' ); 447 // Add custom fonts. 448 $font_version = ( 0 === strpos( (string) twentyfourteen_font_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null; 449 wp_enqueue_style( 'twentyfourteen-fonts', twentyfourteen_font_url(), array(), $font_version ); 450 } 451 add_action( 'enqueue_block_editor_assets', 'twentyfourteen_block_editor_styles' ); 452 453 if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : 454 /** 455 * Prints the attached image with a link to the next attached image. 456 * 457 * @since Twenty Fourteen 1.0 458 */ 459 function twentyfourteen_the_attached_image() { 460 $post = get_post(); 461 /** 462 * Filters the default Twenty Fourteen attachment size. 463 * 464 * @since Twenty Fourteen 1.0 465 * 466 * @param array $dimensions { 467 * An array of height and width dimensions. 468 * 469 * @type int $height Height of the image in pixels. Default 810. 470 * @type int $width Width of the image in pixels. Default 810. 471 * } 472 */ 473 $attachment_size = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) ); 474 $next_attachment_url = wp_get_attachment_url(); 475 476 /* 477 * Grab the IDs of all the image attachments in a gallery so we can get the URL 478 * of the next adjacent image in a gallery, or the first image (if we're 479 * looking at the last image in a gallery), or, in a gallery of one, just the 480 * link to that image file. 481 */ 482 $attachment_ids = get_posts( 483 array( 484 'post_parent' => $post->post_parent, 485 'fields' => 'ids', 486 'numberposts' => -1, 487 'post_status' => 'inherit', 488 'post_type' => 'attachment', 489 'post_mime_type' => 'image', 490 'order' => 'ASC', 491 'orderby' => 'menu_order ID', 492 ) 493 ); 494 495 // If there is more than 1 attachment in a gallery... 496 if ( count( $attachment_ids ) > 1 ) { 497 foreach ( $attachment_ids as $idx => $attachment_id ) { 498 if ( $attachment_id === $post->ID ) { 499 $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ]; 500 break; 501 } 502 } 503 504 if ( $next_id ) { 505 // ...get the URL of the next image attachment. 506 $next_attachment_url = get_attachment_link( $next_id ); 507 } else { 508 // ...or get the URL of the first image attachment. 509 $next_attachment_url = get_attachment_link( reset( $attachment_ids ) ); 510 } 511 } 512 513 printf( 514 '<a href="%1$s" rel="attachment">%2$s</a>', 515 esc_url( $next_attachment_url ), 516 wp_get_attachment_image( $post->ID, $attachment_size ) 517 ); 518 } 519 endif; 520 521 if ( ! function_exists( 'twentyfourteen_list_authors' ) ) : 522 /** 523 * Prints a list of all site contributors who published at least one post. 524 * 525 * @since Twenty Fourteen 1.0 526 */ 527 function twentyfourteen_list_authors() { 528 $args = array( 529 'fields' => 'ID', 530 'orderby' => 'post_count', 531 'order' => 'DESC', 532 'capability' => array( 'edit_posts' ), 533 ); 534 535 // Capability queries were only introduced in WP 5.9. 536 if ( version_compare( $GLOBALS['wp_version'], '5.9-alpha', '<' ) ) { 537 $args['who'] = 'authors'; 538 unset( $args['capability'] ); 539 } 540 541 /** 542 * Filters query arguments for listing authors. 543 * 544 * @since Twenty Fourteen 3.3 545 * 546 * @param array $args Query arguments. 547 */ 548 $args = apply_filters( 'twentyfourteen_list_authors_query_args', $args ); 549 550 $contributor_ids = get_users( $args ); 551 552 foreach ( $contributor_ids as $contributor_id ) : 553 $post_count = count_user_posts( $contributor_id ); 554 555 // Move on if user has not published a post (yet). 556 if ( ! $post_count ) { 557 continue; 558 } 559 ?> 560 561 <div class="contributor"> 562 <div class="contributor-info"> 563 <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div> 564 <div class="contributor-summary"> 565 <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2> 566 <p class="contributor-bio"> 567 <?php echo get_the_author_meta( 'description', $contributor_id ); ?> 568 </p> 569 <a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>"> 570 <?php 571 /* translators: %d: Post count. */ 572 printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); 573 ?> 574 </a> 575 </div><!-- .contributor-summary --> 576 </div><!-- .contributor-info --> 577 </div><!-- .contributor --> 578 579 <?php 580 endforeach; 581 } 582 endif; 583 584 /** 585 * Extends the default WordPress body classes. 586 * 587 * Adds body classes to denote: 588 * 1. Single or multiple authors. 589 * 2. Presence of header image except in Multisite signup and activate pages. 590 * 3. Index views. 591 * 4. Full-width content layout. 592 * 5. Presence of footer widgets. 593 * 6. Single views. 594 * 7. Featured content layout. 595 * 596 * @since Twenty Fourteen 1.0 597 * 598 * @param array $classes A list of existing body class values. 599 * @return array The filtered body class list. 600 */ 601 function twentyfourteen_body_classes( $classes ) { 602 if ( is_multi_author() ) { 603 $classes[] = 'group-blog'; 604 } 605 606 if ( get_header_image() ) { 607 $classes[] = 'header-image'; 608 } elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ), true ) ) { 609 $classes[] = 'masthead-fixed'; 610 } 611 612 if ( is_archive() || is_search() || is_home() ) { 613 $classes[] = 'list-view'; 614 } 615 616 if ( ( ! is_active_sidebar( 'sidebar-2' ) ) 617 || is_page_template( 'page-templates/full-width.php' ) 618 || is_page_template( 'page-templates/contributors.php' ) 619 || is_attachment() ) { 620 $classes[] = 'full-width'; 621 } 622 623 if ( is_active_sidebar( 'sidebar-3' ) ) { 624 $classes[] = 'footer-widgets'; 625 } 626 627 if ( is_singular() && ! is_front_page() ) { 628 $classes[] = 'singular'; 629 } 630 631 if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) { 632 $classes[] = 'slider'; 633 } elseif ( is_front_page() ) { 634 $classes[] = 'grid'; 635 } 636 637 return $classes; 638 } 639 add_filter( 'body_class', 'twentyfourteen_body_classes' ); 640 641 /** 642 * Extends the default WordPress post classes. 643 * 644 * Adds a post class to denote: 645 * Non-password protected page with a post thumbnail. 646 * 647 * @since Twenty Fourteen 1.0 648 * 649 * @param array $classes A list of existing post class values. 650 * @return array The filtered post class list. 651 */ 652 function twentyfourteen_post_classes( $classes ) { 653 if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) { 654 $classes[] = 'has-post-thumbnail'; 655 } 656 657 return $classes; 658 } 659 add_filter( 'post_class', 'twentyfourteen_post_classes' ); 660 661 /** 662 * Creates a nicely formatted and more specific title element text for output 663 * in head of document, based on current view. 664 * 665 * @since Twenty Fourteen 1.0 666 * 667 * @global int $paged WordPress archive pagination page count. 668 * @global int $page WordPress paginated post page count. 669 * 670 * @param string $title Default title text for current view. 671 * @param string $sep Optional separator. 672 * @return string The filtered title. 673 */ 674 function twentyfourteen_wp_title( $title, $sep ) { 675 global $paged, $page; 676 677 if ( is_feed() ) { 678 return $title; 679 } 680 681 // Add the site name. 682 $title .= get_bloginfo( 'name', 'display' ); 683 684 // Add the site description for the home/front page. 685 $site_description = get_bloginfo( 'description', 'display' ); 686 if ( $site_description && ( is_home() || is_front_page() ) ) { 687 $title = "$title $sep $site_description"; 688 } 689 690 // Add a page number if necessary. 691 if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { 692 /* translators: %s: Page number. */ 693 $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); 694 } 695 696 return $title; 697 } 698 add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 ); 699 700 701 /** 702 * Modifies tag cloud widget arguments to display all tags in the same font size 703 * and use list format for better accessibility. 704 * 705 * @since Twenty Fourteen 2.1 706 * 707 * @param array $args Arguments for tag cloud widget. 708 * @return array The filtered arguments for tag cloud widget. 709 */ 710 function twentyfourteen_widget_tag_cloud_args( $args ) { 711 $args['largest'] = 22; 712 $args['smallest'] = 8; 713 $args['unit'] = 'pt'; 714 $args['format'] = 'list'; 715 716 return $args; 717 } 718 add_filter( 'widget_tag_cloud_args', 'twentyfourteen_widget_tag_cloud_args' ); 719 720 721 // Implement Custom Header features. 722 require get_template_directory() . '/inc/custom-header.php'; 723 724 // Custom template tags for this theme. 725 require get_template_directory() . '/inc/template-tags.php'; 726 727 // Add Customizer functionality. 728 require get_template_directory() . '/inc/customizer.php'; 729 730 /** 731 * Registers block patterns and pattern categories. 732 * 733 * @since Twenty Fourteen 4.1 734 */ 735 function twentyfourteen_register_block_patterns() { 736 require get_template_directory() . '/inc/block-patterns.php'; 737 } 738 739 add_action( 'init', 'twentyfourteen_register_block_patterns' ); 740 741 /* 742 * Add Featured Content functionality. 743 * 744 * To overwrite in a plugin, define your own Featured_Content class on or 745 * before the 'setup_theme' hook. 746 */ 747 if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { 748 require get_template_directory() . '/inc/featured-content.php'; 749 } 750 751 /** 752 * Adds an `is_customize_preview` function if it is missing. 753 * 754 * Enables installing Twenty Fourteen in WordPress versions before 4.0.0 when the 755 * `is_customize_preview` function was introduced. 756 * 757 * @global WP_Customize_Manager $wp_customize Customizer object. 758 */ 759 if ( ! function_exists( 'is_customize_preview' ) ) : 760 function is_customize_preview() { 761 global $wp_customize; 762 763 return ( $wp_customize instanceof WP_Customize_Manager ) && $wp_customize->is_preview(); 764 } 765 endif;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Oct 22 08:20:04 2025 | Cross-referenced by PHPXref |