diff --git a/wp-content/themes/twentyseventeen/functions.php b/wp-content/themes/twentyseventeen/functions.php index ebd65c0f9a..0ce0dccb09 100644 --- a/wp-content/themes/twentyseventeen/functions.php +++ b/wp-content/themes/twentyseventeen/functions.php @@ -585,6 +585,30 @@ function twentyseventeen_widget_tag_cloud_args( $args ) { } add_filter( 'widget_tag_cloud_args', 'twentyseventeen_widget_tag_cloud_args' ); +/** + * Get unique ID. + * + * This is a PHP implementation of Underscore's uniqueId method. A static variable + * contains an integer that is incremented with each call. This number is returned + * with the optional prefix. As such the returned value is not universally unique, + * but it is unique across the life of the PHP process. + * + * @since Twenty Seventeen 2.0 + * @see wp_unique_id() Themes requiring WordPress 5.0.3 and greater should use this instead. + * + * @staticvar int $id_counter + * + * @param string $prefix Prefix for the returned ID. + * @return string Unique ID. + */ +function twentyseventeen_unique_id( $prefix = '' ) { + static $id_counter = 0; + if ( function_exists( 'wp_unique_id' ) ) { + return wp_unique_id( $prefix ); + } + return $prefix . (string) ++$id_counter; +} + /** * Implement the Custom Header feature. */ diff --git a/wp-content/themes/twentyseventeen/inc/icon-functions.php b/wp-content/themes/twentyseventeen/inc/icon-functions.php index 3425f740df..0a3c513331 100644 --- a/wp-content/themes/twentyseventeen/inc/icon-functions.php +++ b/wp-content/themes/twentyseventeen/inc/icon-functions.php @@ -74,7 +74,7 @@ function twentyseventeen_get_svg( $args = array() ) { */ if ( $args['title'] ) { $aria_hidden = ''; - $unique_id = uniqid(); + $unique_id = twentyseventeen_unique_id(); $aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"'; if ( $args['desc'] ) { diff --git a/wp-content/themes/twentyseventeen/searchform.php b/wp-content/themes/twentyseventeen/searchform.php index 519c879375..4a38cddafa 100644 --- a/wp-content/themes/twentyseventeen/searchform.php +++ b/wp-content/themes/twentyseventeen/searchform.php @@ -10,7 +10,7 @@ ?> - +