From d4bdc77db3ea52a91f8cb321bc643ec69e23a14b Mon Sep 17 00:00:00 2001 From: francgrasso Date: Mon, 20 Dec 2021 17:30:59 +0100 Subject: [PATCH] improved add_theme_support declaration to avoid warnings in theme_check --- functions.php | 50 +++++++++++++++++++++---------------------- inc/custom-header.php | 20 ++++++++--------- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/functions.php b/functions.php index eebb919..3601b7d 100644 --- a/functions.php +++ b/functions.php @@ -71,48 +71,45 @@ function yith_proteo_setup() { set_theme_mod( 'nav_menu_locations', $menu_locations ); } + $html5_args = array( + 'search-form', + 'comment-form', + 'comment-list', + 'gallery', + 'caption', + ); + /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ - add_theme_support( - 'html5', + add_theme_support( 'html5', $html5_args ); + + $custom_background_args = apply_filters( + 'yith_proteo_custom_background_args', array( - 'search-form', - 'comment-form', - 'comment-list', - 'gallery', - 'caption', + 'default-color' => 'ffffff', + 'default-image' => '', ) ); // Set up the WordPress core custom background feature. - add_theme_support( - 'custom-background', - apply_filters( - 'yith_proteo_custom_background_args', - array( - 'default-color' => 'ffffff', - 'default-image' => '', - ) - ) - ); + add_theme_support( 'custom-background', $custom_background_args ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); + $custom_logo_args = array( + 'height' => 250, + 'width' => 250, + 'flex-width' => true, + 'flex-height' => true, + ); + /** * Add support for core custom logo. */ - add_theme_support( - 'custom-logo', - array( - 'height' => 250, - 'width' => 250, - 'flex-width' => true, - 'flex-height' => true, - ) - ); + add_theme_support( 'custom-logo', $custom_logo_args ); /** * Register additional image size @@ -161,6 +158,7 @@ function yith_proteo_list_additional_image_sizes( $sizes ) { add_theme_support( 'custom-units' ); add_theme_support( 'custom-line-height' ); add_theme_support( 'custom-spacing' ); + add_theme_support( 'wp-block-styles' ); // Add support for experimental link color control. add_theme_support( 'experimental-link-color' ); diff --git a/inc/custom-header.php b/inc/custom-header.php index efff1cf..38eef0c 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -17,19 +17,17 @@ * @uses yith_proteo_header_style() */ function yith_proteo_custom_header_setup() { - add_theme_support( - 'custom-header', - apply_filters( - 'yith_proteo_custom_header_args', - array( - 'default-image' => '', - 'width' => 1920, - 'flex-width' => true, - 'height' => 250, - 'flex-height' => true, - ) + $custom_header_args = apply_filters( + 'yith_proteo_custom_header_args', + array( + 'default-image' => '', + 'width' => 1920, + 'flex-width' => true, + 'height' => 250, + 'flex-height' => true, ) ); + add_theme_support( 'custom-header', $custom_header_args ); } add_action( 'after_setup_theme', 'yith_proteo_custom_header_setup' );