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


Generated: Thu Nov 26 01:00:03 2020 Cross-referenced by PHPXref 0.7.1