[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-content/themes/twentyfourteen/ -> functions.php (source)

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


Generated: Tue Oct 22 08:20:01 2019 Cross-referenced by PHPXref 0.7