diff options
author | Yury German <blueknight@gentoo.org> | 2022-01-23 19:00:40 -0500 |
---|---|---|
committer | Yury German <blueknight@gentoo.org> | 2022-01-23 19:00:40 -0500 |
commit | 89391db6e13b481e2d6eabe0a8475e15c8f9ec28 (patch) | |
tree | eabe327bfe8c37717783217d9ee8fa5c133b367a /themes/twentyfifteen/functions.php | |
parent | Updating Classic Editor, Google Authenticatior, Jetpack, Public Post Preview,... (diff) | |
download | blogs-gentoo-89391db6e13b481e2d6eabe0a8475e15c8f9ec28.tar.gz blogs-gentoo-89391db6e13b481e2d6eabe0a8475e15c8f9ec28.tar.bz2 blogs-gentoo-89391db6e13b481e2d6eabe0a8475e15c8f9ec28.zip |
Bumb Mantra to 3.20 to 3.3.1 and twentififteen from 2.5 to 3.0
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'themes/twentyfifteen/functions.php')
-rw-r--r-- | themes/twentyfifteen/functions.php | 117 |
1 files changed, 75 insertions, 42 deletions
diff --git a/themes/twentyfifteen/functions.php b/themes/twentyfifteen/functions.php index db6451f0..4371cb5c 100644 --- a/themes/twentyfifteen/functions.php +++ b/themes/twentyfifteen/functions.php @@ -11,14 +11,14 @@ * functions.php file. The child theme's functions.php file is included before * the parent theme's file, so the child theme functions would be used. * - * @link https://codex.wordpress.org/Theme_Development + * @link https://developer.wordpress.org/themes/basics/theme-functions/ * @link https://developer.wordpress.org/themes/advanced-topics/child-themes/ * * Functions that are not pluggable (not wrapped in function_exists()) are * instead attached to a filter or action hook. * * For more information on hooks, actions, and filters, - * {@link https://codex.wordpress.org/Plugin_API} + * {@link https://developer.wordpress.org/plugins/} * * @package WordPress * @subpackage Twenty_Fifteen @@ -100,13 +100,16 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) : 'comment-list', 'gallery', 'caption', + 'script', + 'style', + 'navigation-widgets', ) ); /* * Enable support for Post Formats. * - * See: https://codex.wordpress.org/Post_Formats + * See: https://wordpress.org/support/article/post-formats/ */ add_theme_support( 'post-formats', @@ -142,20 +145,20 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) : // Setup the WordPress core custom background feature. - /** - * Filter Twenty Fifteen custom-header support arguments. - * - * @since Twenty Fifteen 1.0 - * - * @param array $args { - * An array of custom-header support arguments. - * - * @type string $default-color Default color of the header. - * @type string $default-attachment Default attachment of the header. - * } - */ add_theme_support( 'custom-background', + /** + * Filters Twenty Fifteen custom-background support arguments. + * + * @since Twenty Fifteen 1.0 + * + * @param array $args { + * An array of custom-background support arguments. + * + * @type string $default-color Default color of the background. + * @type string $default-attachment Default attachment of the background. + * } + */ apply_filters( 'twentyfifteen_custom_background_args', array( @@ -250,7 +253,7 @@ if ( ! function_exists( 'twentyfifteen_setup' ) ) : // Indicate widget sidebars can use selective refresh in the Customizer. add_theme_support( 'customize-selective-refresh-widgets' ); } -endif; // twentyfifteen_setup +endif; // twentyfifteen_setup() add_action( 'after_setup_theme', 'twentyfifteen_setup' ); /** @@ -258,7 +261,7 @@ add_action( 'after_setup_theme', 'twentyfifteen_setup' ); * * @since Twenty Fifteen 1.0 * - * @link https://codex.wordpress.org/Function_Reference/register_sidebar + * @link https://developer.wordpress.org/reference/functions/register_sidebar/ */ function twentyfifteen_widgets_init() { register_sidebar( @@ -289,7 +292,7 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : $subsets = 'latin,latin-ext'; /* - * Translators: If there are characters in your language that are not supported + * translators: If there are characters in your language that are not supported * by Noto Sans, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { @@ -297,7 +300,7 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : } /* - * Translators: If there are characters in your language that are not supported + * translators: If there are characters in your language that are not supported * by Noto Serif, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { @@ -305,7 +308,7 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : } /* - * Translators: If there are characters in your language that are not supported + * translators: If there are characters in your language that are not supported * by Inconsolata, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { @@ -313,26 +316,27 @@ if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) : } /* - * Translators: To add an additional character subset specific to your language, + * translators: To add an additional character subset specific to your language, * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. */ $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); - if ( 'cyrillic' == $subset ) { + if ( 'cyrillic' === $subset ) { $subsets .= ',cyrillic,cyrillic-ext'; - } elseif ( 'greek' == $subset ) { + } elseif ( 'greek' === $subset ) { $subsets .= ',greek,greek-ext'; - } elseif ( 'devanagari' == $subset ) { + } elseif ( 'devanagari' === $subset ) { $subsets .= ',devanagari'; - } elseif ( 'vietnamese' == $subset ) { + } elseif ( 'vietnamese' === $subset ) { $subsets .= ',vietnamese'; } if ( $fonts ) { $fonts_url = add_query_arg( array( - 'family' => urlencode( implode( '|', $fonts ) ), - 'subset' => urlencode( $subsets ), + 'family' => urlencode( implode( '|', $fonts ) ), + 'subset' => urlencode( $subsets ), + 'display' => urlencode( 'fallback' ), ), 'https://fonts.googleapis.com/css' ); @@ -364,33 +368,33 @@ function twentyfifteen_scripts() { wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); // Add Genericons, used in the main stylesheet. - wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' ); + wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '20201208' ); // Load our main stylesheet. - wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() ); + wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri(), array(), '20201208' ); // Theme block stylesheet. - wp_enqueue_style( 'twentyfifteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentyfifteen-style' ), '20181230' ); + wp_enqueue_style( 'twentyfifteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentyfifteen-style' ), '20190102' ); // Load the Internet Explorer specific stylesheet. - wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' ); + wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20170916' ); wp_style_add_data( 'twentyfifteen-ie', 'conditional', 'lt IE 9' ); // Load the Internet Explorer 7 specific stylesheet. - wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' ); + wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141210' ); wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' ); - wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true ); + wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141028', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { - wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' ); + wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141210' ); } - wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true ); + wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20171218', true ); wp_localize_script( 'twentyfifteen-script', 'screenReaderText', @@ -409,7 +413,7 @@ add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); */ function twentyfifteen_block_editor_styles() { // Block styles. - wp_enqueue_style( 'twentyfifteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20181230' ); + wp_enqueue_style( 'twentyfifteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '20201208' ); // Add custom fonts. wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null ); } @@ -457,7 +461,7 @@ function twentyfifteen_post_nav_background() { $next = get_adjacent_post( false, '', false ); $css = ''; - if ( is_attachment() && 'attachment' == $previous->post_type ) { + if ( is_attachment() && 'attachment' === $previous->post_type ) { return; } @@ -488,14 +492,14 @@ add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' ); * * @since Twenty Fifteen 1.0 * - * @param string $item_output The menu item output. - * @param WP_Post $item Menu item object. - * @param int $depth Depth of the menu. - * @param array $args wp_nav_menu() arguments. + * @param string $item_output The menu item's starting HTML output. + * @param WP_Post $item Menu item data object. + * @param int $depth Depth of the menu. Used for padding. + * @param stdClass $args An object of wp_nav_menu() arguments. * @return string Menu item with possible description. */ function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) { - if ( 'primary' == $args->theme_location && $item->description ) { + if ( 'primary' === $args->theme_location && $item->description ) { $item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output ); } @@ -535,6 +539,28 @@ function twentyfifteen_widget_tag_cloud_args( $args ) { } add_filter( 'widget_tag_cloud_args', 'twentyfifteen_widget_tag_cloud_args' ); +/** + * Prevents `author-bio.php` partial template from interfering with rendering + * an author archive of a user with the `bio` username. + * + * @since Twenty Fifteen 2.6 + * + * @param string $template Template file. + * @return string Replacement template file. + */ +function twentyfifteen_author_bio_template( $template ) { + if ( is_author() ) { + $author = get_queried_object(); + if ( $author instanceof WP_User && 'bio' === $author->user_nicename ) { + // Use author templates if exist, fall back to template hierarchy otherwise. + return locate_template( array( "author-{$author->ID}.php", 'author.php' ) ); + } + } + + return $template; +} +add_filter( 'author_template', 'twentyfifteen_author_bio_template' ); + /** * Implement the Custom Header feature. @@ -556,3 +582,10 @@ require get_template_directory() . '/inc/template-tags.php'; * @since Twenty Fifteen 1.0 */ require get_template_directory() . '/inc/customizer.php'; + +/** + * Block Patterns. + * + * @since Twenty Fifteen 3.0 + */ +require get_template_directory() . '/inc/block-patterns.php'; |