[ Index ]

PHP Cross Reference of WordPress

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


Generated: Sun Sep 15 01:00:03 2019 Cross-referenced by PHPXref 0.7.1