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


Generated: Tue Jul 23 01:00:03 2019 Cross-referenced by PHPXref 0.7.1