[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Twenty Seventeen functions and definitions
   4   *
   5   * @link https://developer.wordpress.org/themes/basics/theme-functions/
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Seventeen
   9   * @since 1.0
  10   */
  11  
  12  /**
  13   * Twenty Seventeen only works in WordPress 4.7 or later.
  14   */
  15  if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '<' ) ) {
  16      require get_template_directory() . '/inc/back-compat.php';
  17      return;
  18  }
  19  
  20  /**
  21   * Sets up theme defaults and registers support for various WordPress features.
  22   *
  23   * Note that this function is hooked into the after_setup_theme hook, which
  24   * runs before the init hook. The init hook is too late for some features, such
  25   * as indicating support for post thumbnails.
  26   */
  27  function twentyseventeen_setup() {
  28      /*
  29       * Make theme available for translation.
  30       * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/twentyseventeen
  31       * If you're building a theme based on Twenty Seventeen, use a find and replace
  32       * to change 'twentyseventeen' to the name of your theme in all the template files.
  33       */
  34      load_theme_textdomain( 'twentyseventeen' );
  35  
  36      // Add default posts and comments RSS feed links to head.
  37      add_theme_support( 'automatic-feed-links' );
  38  
  39      /*
  40       * Let WordPress manage the document title.
  41       * By adding theme support, we declare that this theme does not use a
  42       * hard-coded <title> tag in the document head, and expect WordPress to
  43       * provide it for us.
  44       */
  45      add_theme_support( 'title-tag' );
  46  
  47      /*
  48       * Enable support for Post Thumbnails on posts and pages.
  49       *
  50       * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
  51       */
  52      add_theme_support( 'post-thumbnails' );
  53  
  54      add_image_size( 'twentyseventeen-featured-image', 2000, 1200, true );
  55  
  56      add_image_size( 'twentyseventeen-thumbnail-avatar', 100, 100, true );
  57  
  58      // Set the default content width.
  59      $GLOBALS['content_width'] = 525;
  60  
  61      // This theme uses wp_nav_menu() in two locations.
  62      register_nav_menus(
  63          array(
  64              'top'    => __( 'Top Menu', 'twentyseventeen' ),
  65              'social' => __( 'Social Links Menu', 'twentyseventeen' ),
  66          )
  67      );
  68  
  69      /*
  70       * Switch default core markup for search form, comment form, and comments
  71       * to output valid HTML5.
  72       */
  73      add_theme_support(
  74          'html5',
  75          array(
  76              'comment-form',
  77              'comment-list',
  78              'gallery',
  79              'caption',
  80              'script',
  81              'style',
  82          )
  83      );
  84  
  85      /*
  86       * Enable support for Post Formats.
  87       *
  88       * See: https://wordpress.org/support/article/post-formats/
  89       */
  90      add_theme_support(
  91          'post-formats',
  92          array(
  93              'aside',
  94              'image',
  95              'video',
  96              'quote',
  97              'link',
  98              'gallery',
  99              'audio',
 100          )
 101      );
 102  
 103      // Add theme support for Custom Logo.
 104      add_theme_support(
 105          'custom-logo',
 106          array(
 107              'width'      => 250,
 108              'height'     => 250,
 109              'flex-width' => true,
 110          )
 111      );
 112  
 113      // Add theme support for selective refresh for widgets.
 114      add_theme_support( 'customize-selective-refresh-widgets' );
 115  
 116      /*
 117       * This theme styles the visual editor to resemble the theme style,
 118       * specifically font, colors, and column width.
 119        */
 120      add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) );
 121  
 122      // Load regular editor styles into the new block-based editor.
 123      add_theme_support( 'editor-styles' );
 124  
 125      // Load default block styles.
 126      add_theme_support( 'wp-block-styles' );
 127  
 128      // Add support for responsive embeds.
 129      add_theme_support( 'responsive-embeds' );
 130  
 131      // Define and register starter content to showcase the theme on new sites.
 132      $starter_content = array(
 133          'widgets'     => array(
 134              // Place three core-defined widgets in the sidebar area.
 135              'sidebar-1' => array(
 136                  'text_business_info',
 137                  'search',
 138                  'text_about',
 139              ),
 140  
 141              // Add the core-defined business info widget to the footer 1 area.
 142              'sidebar-2' => array(
 143                  'text_business_info',
 144              ),
 145  
 146              // Put two core-defined widgets in the footer 2 area.
 147              'sidebar-3' => array(
 148                  'text_about',
 149                  'search',
 150              ),
 151          ),
 152  
 153          // Specify the core-defined pages to create and add custom thumbnails to some of them.
 154          'posts'       => array(
 155              'home',
 156              'about'            => array(
 157                  'thumbnail' => '{{image-sandwich}}',
 158              ),
 159              'contact'          => array(
 160                  'thumbnail' => '{{image-espresso}}',
 161              ),
 162              'blog'             => array(
 163                  'thumbnail' => '{{image-coffee}}',
 164              ),
 165              'homepage-section' => array(
 166                  'thumbnail' => '{{image-espresso}}',
 167              ),
 168          ),
 169  
 170          // Create the custom image attachments used as post thumbnails for pages.
 171          'attachments' => array(
 172              'image-espresso' => array(
 173                  'post_title' => _x( 'Espresso', 'Theme starter content', 'twentyseventeen' ),
 174                  'file'       => 'assets/images/espresso.jpg', // URL relative to the template directory.
 175              ),
 176              'image-sandwich' => array(
 177                  'post_title' => _x( 'Sandwich', 'Theme starter content', 'twentyseventeen' ),
 178                  'file'       => 'assets/images/sandwich.jpg',
 179              ),
 180              'image-coffee'   => array(
 181                  'post_title' => _x( 'Coffee', 'Theme starter content', 'twentyseventeen' ),
 182                  'file'       => 'assets/images/coffee.jpg',
 183              ),
 184          ),
 185  
 186          // Default to a static front page and assign the front and posts pages.
 187          'options'     => array(
 188              'show_on_front'  => 'page',
 189              'page_on_front'  => '{{home}}',
 190              'page_for_posts' => '{{blog}}',
 191          ),
 192  
 193          // Set the front page section theme mods to the IDs of the core-registered pages.
 194          'theme_mods'  => array(
 195              'panel_1' => '{{homepage-section}}',
 196              'panel_2' => '{{about}}',
 197              'panel_3' => '{{blog}}',
 198              'panel_4' => '{{contact}}',
 199          ),
 200  
 201          // Set up nav menus for each of the two areas registered in the theme.
 202          'nav_menus'   => array(
 203              // Assign a menu to the "top" location.
 204              'top'    => array(
 205                  'name'  => __( 'Top Menu', 'twentyseventeen' ),
 206                  'items' => array(
 207                      'link_home', // Note that the core "home" page is actually a link in case a static front page is not used.
 208                      'page_about',
 209                      'page_blog',
 210                      'page_contact',
 211                  ),
 212              ),
 213  
 214              // Assign a menu to the "social" location.
 215              'social' => array(
 216                  'name'  => __( 'Social Links Menu', 'twentyseventeen' ),
 217                  'items' => array(
 218                      'link_yelp',
 219                      'link_facebook',
 220                      'link_twitter',
 221                      'link_instagram',
 222                      'link_email',
 223                  ),
 224              ),
 225          ),
 226      );
 227  
 228      /**
 229       * Filters Twenty Seventeen array of starter content.
 230       *
 231       * @since Twenty Seventeen 1.1
 232       *
 233       * @param array $starter_content Array of starter content.
 234       */
 235      $starter_content = apply_filters( 'twentyseventeen_starter_content', $starter_content );
 236  
 237      add_theme_support( 'starter-content', $starter_content );
 238  }
 239  add_action( 'after_setup_theme', 'twentyseventeen_setup' );
 240  
 241  /**
 242   * Set the content width in pixels, based on the theme's design and stylesheet.
 243   *
 244   * Priority 0 to make it available to lower priority callbacks.
 245   *
 246   * @global int $content_width
 247   */
 248  function twentyseventeen_content_width() {
 249  
 250      $content_width = $GLOBALS['content_width'];
 251  
 252      // Get layout.
 253      $page_layout = get_theme_mod( 'page_layout' );
 254  
 255      // Check if layout is one column.
 256      if ( 'one-column' === $page_layout ) {
 257          if ( twentyseventeen_is_frontpage() ) {
 258              $content_width = 644;
 259          } elseif ( is_page() ) {
 260              $content_width = 740;
 261          }
 262      }
 263  
 264      // Check if is single post and there is no sidebar.
 265      if ( is_single() && ! is_active_sidebar( 'sidebar-1' ) ) {
 266          $content_width = 740;
 267      }
 268  
 269      /**
 270       * Filter Twenty Seventeen content width of the theme.
 271       *
 272       * @since Twenty Seventeen 1.0
 273       *
 274       * @param int $content_width Content width in pixels.
 275       */
 276      $GLOBALS['content_width'] = apply_filters( 'twentyseventeen_content_width', $content_width );
 277  }
 278  add_action( 'template_redirect', 'twentyseventeen_content_width', 0 );
 279  
 280  /**
 281   * Register custom fonts.
 282   */
 283  function twentyseventeen_fonts_url() {
 284      $fonts_url = '';
 285  
 286      /*
 287       * translators: If there are characters in your language that are not supported
 288       * by Libre Franklin, translate this to 'off'. Do not translate into your own language.
 289       */
 290      $libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'twentyseventeen' );
 291  
 292      if ( 'off' !== $libre_franklin ) {
 293          $font_families = array();
 294  
 295          $font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i';
 296  
 297          $query_args = array(
 298              'family'  => urlencode( implode( '|', $font_families ) ),
 299              'subset'  => urlencode( 'latin,latin-ext' ),
 300              'display' => urlencode( 'fallback' ),
 301          );
 302  
 303          $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
 304      }
 305  
 306      return esc_url_raw( $fonts_url );
 307  }
 308  
 309  /**
 310   * Add preconnect for Google Fonts.
 311   *
 312   * @since Twenty Seventeen 1.0
 313   *
 314   * @param array  $urls           URLs to print for resource hints.
 315   * @param string $relation_type  The relation type the URLs are printed.
 316   * @return array $urls           URLs to print for resource hints.
 317   */
 318  function twentyseventeen_resource_hints( $urls, $relation_type ) {
 319      if ( wp_style_is( 'twentyseventeen-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
 320          $urls[] = array(
 321              'href' => 'https://fonts.gstatic.com',
 322              'crossorigin',
 323          );
 324      }
 325  
 326      return $urls;
 327  }
 328  add_filter( 'wp_resource_hints', 'twentyseventeen_resource_hints', 10, 2 );
 329  
 330  /**
 331   * Register widget area.
 332   *
 333   * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 334   */
 335  function twentyseventeen_widgets_init() {
 336      register_sidebar(
 337          array(
 338              'name'          => __( 'Blog Sidebar', 'twentyseventeen' ),
 339              'id'            => 'sidebar-1',
 340              'description'   => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'twentyseventeen' ),
 341              'before_widget' => '<section id="%1$s" class="widget %2$s">',
 342              'after_widget'  => '</section>',
 343              'before_title'  => '<h2 class="widget-title">',
 344              'after_title'   => '</h2>',
 345          )
 346      );
 347  
 348      register_sidebar(
 349          array(
 350              'name'          => __( 'Footer 1', 'twentyseventeen' ),
 351              'id'            => 'sidebar-2',
 352              'description'   => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ),
 353              'before_widget' => '<section id="%1$s" class="widget %2$s">',
 354              'after_widget'  => '</section>',
 355              'before_title'  => '<h2 class="widget-title">',
 356              'after_title'   => '</h2>',
 357          )
 358      );
 359  
 360      register_sidebar(
 361          array(
 362              'name'          => __( 'Footer 2', 'twentyseventeen' ),
 363              'id'            => 'sidebar-3',
 364              'description'   => __( 'Add widgets here to appear in your footer.', 'twentyseventeen' ),
 365              'before_widget' => '<section id="%1$s" class="widget %2$s">',
 366              'after_widget'  => '</section>',
 367              'before_title'  => '<h2 class="widget-title">',
 368              'after_title'   => '</h2>',
 369          )
 370      );
 371  }
 372  add_action( 'widgets_init', 'twentyseventeen_widgets_init' );
 373  
 374  /**
 375   * Replaces "[...]" (appended to automatically generated excerpts) with ... and
 376   * a 'Continue reading' link.
 377   *
 378   * @since Twenty Seventeen 1.0
 379   *
 380   * @param string $link Link to single post/page.
 381   * @return string 'Continue reading' link prepended with an ellipsis.
 382   */
 383  function twentyseventeen_excerpt_more( $link ) {
 384      if ( is_admin() ) {
 385          return $link;
 386      }
 387  
 388      $link = sprintf(
 389          '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
 390          esc_url( get_permalink( get_the_ID() ) ),
 391          /* translators: %s: Post title. */
 392          sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), get_the_title( get_the_ID() ) )
 393      );
 394      return ' &hellip; ' . $link;
 395  }
 396  add_filter( 'excerpt_more', 'twentyseventeen_excerpt_more' );
 397  
 398  /**
 399   * Handles JavaScript detection.
 400   *
 401   * Adds a `js` class to the root `<html>` element when JavaScript is detected.
 402   *
 403   * @since Twenty Seventeen 1.0
 404   */
 405  function twentyseventeen_javascript_detection() {
 406      echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
 407  }
 408  add_action( 'wp_head', 'twentyseventeen_javascript_detection', 0 );
 409  
 410  /**
 411   * Add a pingback url auto-discovery header for singularly identifiable articles.
 412   */
 413  function twentyseventeen_pingback_header() {
 414      if ( is_singular() && pings_open() ) {
 415          printf( '<link rel="pingback" href="%s">' . "\n", esc_url( get_bloginfo( 'pingback_url' ) ) );
 416      }
 417  }
 418  add_action( 'wp_head', 'twentyseventeen_pingback_header' );
 419  
 420  /**
 421   * Display custom color CSS.
 422   */
 423  function twentyseventeen_colors_css_wrap() {
 424      if ( 'custom' !== get_theme_mod( 'colorscheme' ) && ! is_customize_preview() ) {
 425          return;
 426      }
 427  
 428      require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) );
 429      $hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) );
 430  
 431      $customize_preview_data_hue = '';
 432      if ( is_customize_preview() ) {
 433          $customize_preview_data_hue = 'data-hue="' . $hue . '"';
 434      }
 435      ?>
 436      <style type="text/css" id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>>
 437          <?php echo twentyseventeen_custom_colors_css(); ?>
 438      </style>
 439      <?php
 440  }
 441  add_action( 'wp_head', 'twentyseventeen_colors_css_wrap' );
 442  
 443  /**
 444   * Enqueues scripts and styles.
 445   */
 446  function twentyseventeen_scripts() {
 447      // Add custom fonts, used in the main stylesheet.
 448      wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null );
 449  
 450      // Theme stylesheet.
 451      wp_enqueue_style( 'twentyseventeen-style', get_stylesheet_uri(), array(), '20190507' );
 452  
 453      // Theme block stylesheet.
 454      wp_enqueue_style( 'twentyseventeen-block-style', get_theme_file_uri( '/assets/css/blocks.css' ), array( 'twentyseventeen-style' ), '20190105' );
 455  
 456      // Load the dark colorscheme.
 457      if ( 'dark' === get_theme_mod( 'colorscheme', 'light' ) || is_customize_preview() ) {
 458          wp_enqueue_style( 'twentyseventeen-colors-dark', get_theme_file_uri( '/assets/css/colors-dark.css' ), array( 'twentyseventeen-style' ), '20190408' );
 459      }
 460  
 461      // Load the Internet Explorer 9 specific stylesheet, to fix display issues in the Customizer.
 462      if ( is_customize_preview() ) {
 463          wp_enqueue_style( 'twentyseventeen-ie9', get_theme_file_uri( '/assets/css/ie9.css' ), array( 'twentyseventeen-style' ), '20161202' );
 464          wp_style_add_data( 'twentyseventeen-ie9', 'conditional', 'IE 9' );
 465      }
 466  
 467      // Load the Internet Explorer 8 specific stylesheet.
 468      wp_enqueue_style( 'twentyseventeen-ie8', get_theme_file_uri( '/assets/css/ie8.css' ), array( 'twentyseventeen-style' ), '20161202' );
 469      wp_style_add_data( 'twentyseventeen-ie8', 'conditional', 'lt IE 9' );
 470  
 471      // Load the html5 shiv.
 472      wp_enqueue_script( 'html5', get_theme_file_uri( '/assets/js/html5.js' ), array(), '20161020' );
 473      wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );
 474  
 475      wp_enqueue_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '20161114', true );
 476  
 477      $twentyseventeen_l10n = array(
 478          'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ),
 479      );
 480  
 481      if ( has_nav_menu( 'top' ) ) {
 482          wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '20161203', true );
 483          $twentyseventeen_l10n['expand']   = __( 'Expand child menu', 'twentyseventeen' );
 484          $twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' );
 485          $twentyseventeen_l10n['icon']     = twentyseventeen_get_svg(
 486              array(
 487                  'icon'     => 'angle-down',
 488                  'fallback' => true,
 489              )
 490          );
 491      }
 492  
 493      wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20190121', true );
 494  
 495      wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.2', true );
 496  
 497      wp_localize_script( 'twentyseventeen-skip-link-focus-fix', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n );
 498  
 499      if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
 500          wp_enqueue_script( 'comment-reply' );
 501      }
 502  }
 503  add_action( 'wp_enqueue_scripts', 'twentyseventeen_scripts' );
 504  
 505  /**
 506   * Enqueues styles for the block-based editor.
 507   *
 508   * @since Twenty Seventeen 1.8
 509   */
 510  function twentyseventeen_block_editor_styles() {
 511      // Block styles.
 512      wp_enqueue_style( 'twentyseventeen-block-editor-style', get_theme_file_uri( '/assets/css/editor-blocks.css' ), array(), '20190328' );
 513      // Add custom fonts.
 514      wp_enqueue_style( 'twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null );
 515  }
 516  add_action( 'enqueue_block_editor_assets', 'twentyseventeen_block_editor_styles' );
 517  
 518  /**
 519   * Add custom image sizes attribute to enhance responsive image functionality
 520   * for content images.
 521   *
 522   * @since Twenty Seventeen 1.0
 523   *
 524   * @param string $sizes A source size value for use in a 'sizes' attribute.
 525   * @param array  $size  Image size. Accepts an array of width and height
 526   *                      values in pixels (in that order).
 527   * @return string A source size value for use in a content image 'sizes' attribute.
 528   */
 529  function twentyseventeen_content_image_sizes_attr( $sizes, $size ) {
 530      $width = $size[0];
 531  
 532      if ( 740 <= $width ) {
 533          $sizes = '(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px';
 534      }
 535  
 536      if ( is_active_sidebar( 'sidebar-1' ) || is_archive() || is_search() || is_home() || is_page() ) {
 537          if ( ! ( is_page() && 'one-column' === get_theme_mod( 'page_options' ) ) && 767 <= $width ) {
 538              $sizes = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px';
 539          }
 540      }
 541  
 542      return $sizes;
 543  }
 544  add_filter( 'wp_calculate_image_sizes', 'twentyseventeen_content_image_sizes_attr', 10, 2 );
 545  
 546  /**
 547   * Filter the `sizes` value in the header image markup.
 548   *
 549   * @since Twenty Seventeen 1.0
 550   *
 551   * @param string $html   The HTML image tag markup being filtered.
 552   * @param object $header The custom header object returned by 'get_custom_header()'.
 553   * @param array  $attr   Array of the attributes for the image tag.
 554   * @return string The filtered header image HTML.
 555   */
 556  function twentyseventeen_header_image_tag( $html, $header, $attr ) {
 557      if ( isset( $attr['sizes'] ) ) {
 558          $html = str_replace( $attr['sizes'], '100vw', $html );
 559      }
 560      return $html;
 561  }
 562  add_filter( 'get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3 );
 563  
 564  /**
 565   * Add custom image sizes attribute to enhance responsive image functionality
 566   * for post thumbnails.
 567   *
 568   * @since Twenty Seventeen 1.0
 569   *
 570   * @param array $attr       Attributes for the image markup.
 571   * @param int   $attachment Image attachment ID.
 572   * @param array $size       Registered image size or flat array of height and width dimensions.
 573   * @return array The filtered attributes for the image markup.
 574   */
 575  function twentyseventeen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
 576      if ( is_archive() || is_search() || is_home() ) {
 577          $attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px';
 578      } else {
 579          $attr['sizes'] = '100vw';
 580      }
 581  
 582      return $attr;
 583  }
 584  add_filter( 'wp_get_attachment_image_attributes', 'twentyseventeen_post_thumbnail_sizes_attr', 10, 3 );
 585  
 586  /**
 587   * Use front-page.php when Front page displays is set to a static page.
 588   *
 589   * @since Twenty Seventeen 1.0
 590   *
 591   * @param string $template front-page.php.
 592   *
 593   * @return string The template to be used: blank if is_home() is true (defaults to index.php), else $template.
 594   */
 595  function twentyseventeen_front_page_template( $template ) {
 596      return is_home() ? '' : $template;
 597  }
 598  add_filter( 'frontpage_template', 'twentyseventeen_front_page_template' );
 599  
 600  /**
 601   * Modifies tag cloud widget arguments to display all tags in the same font size
 602   * and use list format for better accessibility.
 603   *
 604   * @since Twenty Seventeen 1.4
 605   *
 606   * @param array $args Arguments for tag cloud widget.
 607   * @return array The filtered arguments for tag cloud widget.
 608   */
 609  function twentyseventeen_widget_tag_cloud_args( $args ) {
 610      $args['largest']  = 1;
 611      $args['smallest'] = 1;
 612      $args['unit']     = 'em';
 613      $args['format']   = 'list';
 614  
 615      return $args;
 616  }
 617  add_filter( 'widget_tag_cloud_args', 'twentyseventeen_widget_tag_cloud_args' );
 618  
 619  /**
 620   * Get unique ID.
 621   *
 622   * This is a PHP implementation of Underscore's uniqueId method. A static variable
 623   * contains an integer that is incremented with each call. This number is returned
 624   * with the optional prefix. As such the returned value is not universally unique,
 625   * but it is unique across the life of the PHP process.
 626   *
 627   * @since Twenty Seventeen 2.0
 628   * @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead.
 629   *
 630   * @staticvar int $id_counter
 631   *
 632   * @param string $prefix Prefix for the returned ID.
 633   * @return string Unique ID.
 634   */
 635  function twentyseventeen_unique_id( $prefix = '' ) {
 636      static $id_counter = 0;
 637      if ( function_exists( 'wp_unique_id' ) ) {
 638          return wp_unique_id( $prefix );
 639      }
 640      return $prefix . (string) ++$id_counter;
 641  }
 642  
 643  /**
 644   * Implement the Custom Header feature.
 645   */
 646  require get_parent_theme_file_path( '/inc/custom-header.php' );
 647  
 648  /**
 649   * Custom template tags for this theme.
 650   */
 651  require get_parent_theme_file_path( '/inc/template-tags.php' );
 652  
 653  /**
 654   * Additional features to allow styling of the templates.
 655   */
 656  require get_parent_theme_file_path( '/inc/template-functions.php' );
 657  
 658  /**
 659   * Customizer additions.
 660   */
 661  require get_parent_theme_file_path( '/inc/customizer.php' );
 662  
 663  /**
 664   * SVG icons functions and filters.
 665   */
 666  require get_parent_theme_file_path( '/inc/icon-functions.php' );


Generated: Thu Sep 19 01:00:03 2019 Cross-referenced by PHPXref 0.7.1