Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: theme.php
<style id="custom-logo-css"<?php echo $type_attr; ?>>
[3000] Fix | Delete
<?php echo $classes; ?> {
[3001] Fix | Delete
position: absolute;
[3002] Fix | Delete
clip: rect(1px, 1px, 1px, 1px);
[3003] Fix | Delete
}
[3004] Fix | Delete
</style>
[3005] Fix | Delete
<?php
[3006] Fix | Delete
}
[3007] Fix | Delete
}
[3008] Fix | Delete
[3009] Fix | Delete
/**
[3010] Fix | Delete
* Gets the theme support arguments passed when registering that support.
[3011] Fix | Delete
*
[3012] Fix | Delete
* Example usage:
[3013] Fix | Delete
*
[3014] Fix | Delete
* get_theme_support( 'custom-logo' );
[3015] Fix | Delete
* get_theme_support( 'custom-header', 'width' );
[3016] Fix | Delete
*
[3017] Fix | Delete
* @since 3.1.0
[3018] Fix | Delete
* @since 5.3.0 Formalized the existing and already documented `...$args` parameter
[3019] Fix | Delete
* by adding it to the function signature.
[3020] Fix | Delete
*
[3021] Fix | Delete
* @global array $_wp_theme_features
[3022] Fix | Delete
*
[3023] Fix | Delete
* @param string $feature The feature to check. See add_theme_support() for the list
[3024] Fix | Delete
* of possible values.
[3025] Fix | Delete
* @param mixed ...$args Optional extra arguments to be checked against certain features.
[3026] Fix | Delete
* @return mixed The array of extra arguments or the value for the registered feature.
[3027] Fix | Delete
*/
[3028] Fix | Delete
function get_theme_support( $feature, ...$args ) {
[3029] Fix | Delete
global $_wp_theme_features;
[3030] Fix | Delete
[3031] Fix | Delete
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
[3032] Fix | Delete
return false;
[3033] Fix | Delete
}
[3034] Fix | Delete
[3035] Fix | Delete
if ( ! $args ) {
[3036] Fix | Delete
return $_wp_theme_features[ $feature ];
[3037] Fix | Delete
}
[3038] Fix | Delete
[3039] Fix | Delete
switch ( $feature ) {
[3040] Fix | Delete
case 'custom-logo':
[3041] Fix | Delete
case 'custom-header':
[3042] Fix | Delete
case 'custom-background':
[3043] Fix | Delete
if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) {
[3044] Fix | Delete
return $_wp_theme_features[ $feature ][0][ $args[0] ];
[3045] Fix | Delete
}
[3046] Fix | Delete
return false;
[3047] Fix | Delete
[3048] Fix | Delete
default:
[3049] Fix | Delete
return $_wp_theme_features[ $feature ];
[3050] Fix | Delete
}
[3051] Fix | Delete
}
[3052] Fix | Delete
[3053] Fix | Delete
/**
[3054] Fix | Delete
* Allows a theme to de-register its support of a certain feature
[3055] Fix | Delete
*
[3056] Fix | Delete
* Should be called in the theme's functions.php file. Generally would
[3057] Fix | Delete
* be used for child themes to override support from the parent theme.
[3058] Fix | Delete
*
[3059] Fix | Delete
* @since 3.0.0
[3060] Fix | Delete
*
[3061] Fix | Delete
* @see add_theme_support()
[3062] Fix | Delete
*
[3063] Fix | Delete
* @param string $feature The feature being removed. See add_theme_support() for the list
[3064] Fix | Delete
* of possible values.
[3065] Fix | Delete
* @return bool|void Whether feature was removed.
[3066] Fix | Delete
*/
[3067] Fix | Delete
function remove_theme_support( $feature ) {
[3068] Fix | Delete
// Do not remove internal registrations that are not used directly by themes.
[3069] Fix | Delete
if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ), true ) ) {
[3070] Fix | Delete
return false;
[3071] Fix | Delete
}
[3072] Fix | Delete
[3073] Fix | Delete
return _remove_theme_support( $feature );
[3074] Fix | Delete
}
[3075] Fix | Delete
[3076] Fix | Delete
/**
[3077] Fix | Delete
* Do not use. Removes theme support internally without knowledge of those not used
[3078] Fix | Delete
* by themes directly.
[3079] Fix | Delete
*
[3080] Fix | Delete
* @access private
[3081] Fix | Delete
* @since 3.1.0
[3082] Fix | Delete
* @global array $_wp_theme_features
[3083] Fix | Delete
* @global Custom_Image_Header $custom_image_header
[3084] Fix | Delete
* @global Custom_Background $custom_background
[3085] Fix | Delete
*
[3086] Fix | Delete
* @param string $feature The feature being removed. See add_theme_support() for the list
[3087] Fix | Delete
* of possible values.
[3088] Fix | Delete
* @return bool True if support was removed, false if the feature was not registered.
[3089] Fix | Delete
*/
[3090] Fix | Delete
function _remove_theme_support( $feature ) {
[3091] Fix | Delete
global $_wp_theme_features;
[3092] Fix | Delete
[3093] Fix | Delete
switch ( $feature ) {
[3094] Fix | Delete
case 'custom-header-uploads':
[3095] Fix | Delete
if ( ! isset( $_wp_theme_features['custom-header'] ) ) {
[3096] Fix | Delete
return false;
[3097] Fix | Delete
}
[3098] Fix | Delete
add_theme_support( 'custom-header', array( 'uploads' => false ) );
[3099] Fix | Delete
return; // Do not continue - custom-header-uploads no longer exists.
[3100] Fix | Delete
}
[3101] Fix | Delete
[3102] Fix | Delete
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
[3103] Fix | Delete
return false;
[3104] Fix | Delete
}
[3105] Fix | Delete
[3106] Fix | Delete
switch ( $feature ) {
[3107] Fix | Delete
case 'custom-header':
[3108] Fix | Delete
if ( ! did_action( 'wp_loaded' ) ) {
[3109] Fix | Delete
break;
[3110] Fix | Delete
}
[3111] Fix | Delete
$support = get_theme_support( 'custom-header' );
[3112] Fix | Delete
if ( isset( $support[0]['wp-head-callback'] ) ) {
[3113] Fix | Delete
remove_action( 'wp_head', $support[0]['wp-head-callback'] );
[3114] Fix | Delete
}
[3115] Fix | Delete
if ( isset( $GLOBALS['custom_image_header'] ) ) {
[3116] Fix | Delete
remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) );
[3117] Fix | Delete
unset( $GLOBALS['custom_image_header'] );
[3118] Fix | Delete
}
[3119] Fix | Delete
break;
[3120] Fix | Delete
[3121] Fix | Delete
case 'custom-background':
[3122] Fix | Delete
if ( ! did_action( 'wp_loaded' ) ) {
[3123] Fix | Delete
break;
[3124] Fix | Delete
}
[3125] Fix | Delete
$support = get_theme_support( 'custom-background' );
[3126] Fix | Delete
if ( isset( $support[0]['wp-head-callback'] ) ) {
[3127] Fix | Delete
remove_action( 'wp_head', $support[0]['wp-head-callback'] );
[3128] Fix | Delete
}
[3129] Fix | Delete
remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
[3130] Fix | Delete
unset( $GLOBALS['custom_background'] );
[3131] Fix | Delete
break;
[3132] Fix | Delete
}
[3133] Fix | Delete
[3134] Fix | Delete
unset( $_wp_theme_features[ $feature ] );
[3135] Fix | Delete
[3136] Fix | Delete
return true;
[3137] Fix | Delete
}
[3138] Fix | Delete
[3139] Fix | Delete
/**
[3140] Fix | Delete
* Checks a theme's support for a given feature.
[3141] Fix | Delete
*
[3142] Fix | Delete
* Example usage:
[3143] Fix | Delete
*
[3144] Fix | Delete
* current_theme_supports( 'custom-logo' );
[3145] Fix | Delete
* current_theme_supports( 'html5', 'comment-form' );
[3146] Fix | Delete
*
[3147] Fix | Delete
* @since 2.9.0
[3148] Fix | Delete
* @since 5.3.0 Formalized the existing and already documented `...$args` parameter
[3149] Fix | Delete
* by adding it to the function signature.
[3150] Fix | Delete
*
[3151] Fix | Delete
* @global array $_wp_theme_features
[3152] Fix | Delete
*
[3153] Fix | Delete
* @param string $feature The feature being checked. See add_theme_support() for the list
[3154] Fix | Delete
* of possible values.
[3155] Fix | Delete
* @param mixed ...$args Optional extra arguments to be checked against certain features.
[3156] Fix | Delete
* @return bool True if the active theme supports the feature, false otherwise.
[3157] Fix | Delete
*/
[3158] Fix | Delete
function current_theme_supports( $feature, ...$args ) {
[3159] Fix | Delete
global $_wp_theme_features;
[3160] Fix | Delete
[3161] Fix | Delete
if ( 'custom-header-uploads' === $feature ) {
[3162] Fix | Delete
return current_theme_supports( 'custom-header', 'uploads' );
[3163] Fix | Delete
}
[3164] Fix | Delete
[3165] Fix | Delete
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
[3166] Fix | Delete
return false;
[3167] Fix | Delete
}
[3168] Fix | Delete
[3169] Fix | Delete
// If no args passed then no extra checks need to be performed.
[3170] Fix | Delete
if ( ! $args ) {
[3171] Fix | Delete
/** This filter is documented in wp-includes/theme.php */
[3172] Fix | Delete
return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[3173] Fix | Delete
}
[3174] Fix | Delete
[3175] Fix | Delete
switch ( $feature ) {
[3176] Fix | Delete
case 'post-thumbnails':
[3177] Fix | Delete
/*
[3178] Fix | Delete
* post-thumbnails can be registered for only certain content/post types
[3179] Fix | Delete
* by passing an array of types to add_theme_support().
[3180] Fix | Delete
* If no array was passed, then any type is accepted.
[3181] Fix | Delete
*/
[3182] Fix | Delete
if ( true === $_wp_theme_features[ $feature ] ) { // Registered for all types.
[3183] Fix | Delete
return true;
[3184] Fix | Delete
}
[3185] Fix | Delete
$content_type = $args[0];
[3186] Fix | Delete
return in_array( $content_type, $_wp_theme_features[ $feature ][0], true );
[3187] Fix | Delete
[3188] Fix | Delete
case 'html5':
[3189] Fix | Delete
case 'post-formats':
[3190] Fix | Delete
/*
[3191] Fix | Delete
* Specific post formats can be registered by passing an array of types
[3192] Fix | Delete
* to add_theme_support().
[3193] Fix | Delete
*
[3194] Fix | Delete
* Specific areas of HTML5 support *must* be passed via an array to add_theme_support().
[3195] Fix | Delete
*/
[3196] Fix | Delete
$type = $args[0];
[3197] Fix | Delete
return in_array( $type, $_wp_theme_features[ $feature ][0], true );
[3198] Fix | Delete
[3199] Fix | Delete
case 'custom-logo':
[3200] Fix | Delete
case 'custom-header':
[3201] Fix | Delete
case 'custom-background':
[3202] Fix | Delete
// Specific capabilities can be registered by passing an array to add_theme_support().
[3203] Fix | Delete
return ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) && $_wp_theme_features[ $feature ][0][ $args[0] ] );
[3204] Fix | Delete
}
[3205] Fix | Delete
[3206] Fix | Delete
/**
[3207] Fix | Delete
* Filters whether the active theme supports a specific feature.
[3208] Fix | Delete
*
[3209] Fix | Delete
* The dynamic portion of the hook name, `$feature`, refers to the specific
[3210] Fix | Delete
* theme feature. See add_theme_support() for the list of possible values.
[3211] Fix | Delete
*
[3212] Fix | Delete
* @since 3.4.0
[3213] Fix | Delete
*
[3214] Fix | Delete
* @param bool $supports Whether the active theme supports the given feature. Default true.
[3215] Fix | Delete
* @param array $args Array of arguments for the feature.
[3216] Fix | Delete
* @param string $feature The theme feature.
[3217] Fix | Delete
*/
[3218] Fix | Delete
return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[3219] Fix | Delete
}
[3220] Fix | Delete
[3221] Fix | Delete
/**
[3222] Fix | Delete
* Checks a theme's support for a given feature before loading the functions which implement it.
[3223] Fix | Delete
*
[3224] Fix | Delete
* @since 2.9.0
[3225] Fix | Delete
*
[3226] Fix | Delete
* @param string $feature The feature being checked. See add_theme_support() for the list
[3227] Fix | Delete
* of possible values.
[3228] Fix | Delete
* @param string $file Path to the file.
[3229] Fix | Delete
* @return bool True if the active theme supports the supplied feature, false otherwise.
[3230] Fix | Delete
*/
[3231] Fix | Delete
function require_if_theme_supports( $feature, $file ) {
[3232] Fix | Delete
if ( current_theme_supports( $feature ) ) {
[3233] Fix | Delete
require $file;
[3234] Fix | Delete
return true;
[3235] Fix | Delete
}
[3236] Fix | Delete
return false;
[3237] Fix | Delete
}
[3238] Fix | Delete
[3239] Fix | Delete
/**
[3240] Fix | Delete
* Registers a theme feature for use in add_theme_support().
[3241] Fix | Delete
*
[3242] Fix | Delete
* This does not indicate that the active theme supports the feature, it only describes
[3243] Fix | Delete
* the feature's supported options.
[3244] Fix | Delete
*
[3245] Fix | Delete
* @since 5.5.0
[3246] Fix | Delete
*
[3247] Fix | Delete
* @see add_theme_support()
[3248] Fix | Delete
*
[3249] Fix | Delete
* @global array $_wp_registered_theme_features
[3250] Fix | Delete
*
[3251] Fix | Delete
* @param string $feature The name uniquely identifying the feature. See add_theme_support()
[3252] Fix | Delete
* for the list of possible values.
[3253] Fix | Delete
* @param array $args {
[3254] Fix | Delete
* Data used to describe the theme.
[3255] Fix | Delete
*
[3256] Fix | Delete
* @type string $type The type of data associated with this feature.
[3257] Fix | Delete
* Valid values are 'string', 'boolean', 'integer',
[3258] Fix | Delete
* 'number', 'array', and 'object'. Defaults to 'boolean'.
[3259] Fix | Delete
* @type bool $variadic Does this feature utilize the variadic support
[3260] Fix | Delete
* of add_theme_support(), or are all arguments specified
[3261] Fix | Delete
* as the second parameter. Must be used with the "array" type.
[3262] Fix | Delete
* @type string $description A short description of the feature. Included in
[3263] Fix | Delete
* the Themes REST API schema. Intended for developers.
[3264] Fix | Delete
* @type bool|array $show_in_rest {
[3265] Fix | Delete
* Whether this feature should be included in the Themes REST API endpoint.
[3266] Fix | Delete
* Defaults to not being included. When registering an 'array' or 'object' type,
[3267] Fix | Delete
* this argument must be an array with the 'schema' key.
[3268] Fix | Delete
*
[3269] Fix | Delete
* @type array $schema Specifies the JSON Schema definition describing
[3270] Fix | Delete
* the feature. If any objects in the schema do not include
[3271] Fix | Delete
* the 'additionalProperties' keyword, it is set to false.
[3272] Fix | Delete
* @type string $name An alternate name to be used as the property name
[3273] Fix | Delete
* in the REST API.
[3274] Fix | Delete
* @type callable $prepare_callback A function used to format the theme support in the REST API.
[3275] Fix | Delete
* Receives the raw theme support value.
[3276] Fix | Delete
* }
[3277] Fix | Delete
* }
[3278] Fix | Delete
* @return true|WP_Error True if the theme feature was successfully registered, a WP_Error object if not.
[3279] Fix | Delete
*/
[3280] Fix | Delete
function register_theme_feature( $feature, $args = array() ) {
[3281] Fix | Delete
global $_wp_registered_theme_features;
[3282] Fix | Delete
[3283] Fix | Delete
if ( ! is_array( $_wp_registered_theme_features ) ) {
[3284] Fix | Delete
$_wp_registered_theme_features = array();
[3285] Fix | Delete
}
[3286] Fix | Delete
[3287] Fix | Delete
$defaults = array(
[3288] Fix | Delete
'type' => 'boolean',
[3289] Fix | Delete
'variadic' => false,
[3290] Fix | Delete
'description' => '',
[3291] Fix | Delete
'show_in_rest' => false,
[3292] Fix | Delete
);
[3293] Fix | Delete
[3294] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[3295] Fix | Delete
[3296] Fix | Delete
if ( true === $args['show_in_rest'] ) {
[3297] Fix | Delete
$args['show_in_rest'] = array();
[3298] Fix | Delete
}
[3299] Fix | Delete
[3300] Fix | Delete
if ( is_array( $args['show_in_rest'] ) ) {
[3301] Fix | Delete
$args['show_in_rest'] = wp_parse_args(
[3302] Fix | Delete
$args['show_in_rest'],
[3303] Fix | Delete
array(
[3304] Fix | Delete
'schema' => array(),
[3305] Fix | Delete
'name' => $feature,
[3306] Fix | Delete
'prepare_callback' => null,
[3307] Fix | Delete
)
[3308] Fix | Delete
);
[3309] Fix | Delete
}
[3310] Fix | Delete
[3311] Fix | Delete
if ( ! in_array( $args['type'], array( 'string', 'boolean', 'integer', 'number', 'array', 'object' ), true ) ) {
[3312] Fix | Delete
return new WP_Error(
[3313] Fix | Delete
'invalid_type',
[3314] Fix | Delete
__( 'The feature "type" is not valid JSON Schema type.' )
[3315] Fix | Delete
);
[3316] Fix | Delete
}
[3317] Fix | Delete
[3318] Fix | Delete
if ( true === $args['variadic'] && 'array' !== $args['type'] ) {
[3319] Fix | Delete
return new WP_Error(
[3320] Fix | Delete
'variadic_must_be_array',
[3321] Fix | Delete
__( 'When registering a "variadic" theme feature, the "type" must be an "array".' )
[3322] Fix | Delete
);
[3323] Fix | Delete
}
[3324] Fix | Delete
[3325] Fix | Delete
if ( false !== $args['show_in_rest'] && in_array( $args['type'], array( 'array', 'object' ), true ) ) {
[3326] Fix | Delete
if ( ! is_array( $args['show_in_rest'] ) || empty( $args['show_in_rest']['schema'] ) ) {
[3327] Fix | Delete
return new WP_Error(
[3328] Fix | Delete
'missing_schema',
[3329] Fix | Delete
__( 'When registering an "array" or "object" feature to show in the REST API, the feature\'s schema must also be defined.' )
[3330] Fix | Delete
);
[3331] Fix | Delete
}
[3332] Fix | Delete
[3333] Fix | Delete
if ( 'array' === $args['type'] && ! isset( $args['show_in_rest']['schema']['items'] ) ) {
[3334] Fix | Delete
return new WP_Error(
[3335] Fix | Delete
'missing_schema_items',
[3336] Fix | Delete
__( 'When registering an "array" feature, the feature\'s schema must include the "items" keyword.' )
[3337] Fix | Delete
);
[3338] Fix | Delete
}
[3339] Fix | Delete
[3340] Fix | Delete
if ( 'object' === $args['type'] && ! isset( $args['show_in_rest']['schema']['properties'] ) ) {
[3341] Fix | Delete
return new WP_Error(
[3342] Fix | Delete
'missing_schema_properties',
[3343] Fix | Delete
__( 'When registering an "object" feature, the feature\'s schema must include the "properties" keyword.' )
[3344] Fix | Delete
);
[3345] Fix | Delete
}
[3346] Fix | Delete
}
[3347] Fix | Delete
[3348] Fix | Delete
if ( is_array( $args['show_in_rest'] ) ) {
[3349] Fix | Delete
if ( isset( $args['show_in_rest']['prepare_callback'] )
[3350] Fix | Delete
&& ! is_callable( $args['show_in_rest']['prepare_callback'] )
[3351] Fix | Delete
) {
[3352] Fix | Delete
return new WP_Error(
[3353] Fix | Delete
'invalid_rest_prepare_callback',
[3354] Fix | Delete
sprintf(
[3355] Fix | Delete
/* translators: %s: prepare_callback */
[3356] Fix | Delete
__( 'The "%s" must be a callable function.' ),
[3357] Fix | Delete
'prepare_callback'
[3358] Fix | Delete
)
[3359] Fix | Delete
);
[3360] Fix | Delete
}
[3361] Fix | Delete
[3362] Fix | Delete
$args['show_in_rest']['schema'] = wp_parse_args(
[3363] Fix | Delete
$args['show_in_rest']['schema'],
[3364] Fix | Delete
array(
[3365] Fix | Delete
'description' => $args['description'],
[3366] Fix | Delete
'type' => $args['type'],
[3367] Fix | Delete
'default' => false,
[3368] Fix | Delete
)
[3369] Fix | Delete
);
[3370] Fix | Delete
[3371] Fix | Delete
if ( is_bool( $args['show_in_rest']['schema']['default'] )
[3372] Fix | Delete
&& ! in_array( 'boolean', (array) $args['show_in_rest']['schema']['type'], true )
[3373] Fix | Delete
) {
[3374] Fix | Delete
// Automatically include the "boolean" type when the default value is a boolean.
[3375] Fix | Delete
$args['show_in_rest']['schema']['type'] = (array) $args['show_in_rest']['schema']['type'];
[3376] Fix | Delete
array_unshift( $args['show_in_rest']['schema']['type'], 'boolean' );
[3377] Fix | Delete
}
[3378] Fix | Delete
[3379] Fix | Delete
$args['show_in_rest']['schema'] = rest_default_additional_properties_to_false( $args['show_in_rest']['schema'] );
[3380] Fix | Delete
}
[3381] Fix | Delete
[3382] Fix | Delete
$_wp_registered_theme_features[ $feature ] = $args;
[3383] Fix | Delete
[3384] Fix | Delete
return true;
[3385] Fix | Delete
}
[3386] Fix | Delete
[3387] Fix | Delete
/**
[3388] Fix | Delete
* Gets the list of registered theme features.
[3389] Fix | Delete
*
[3390] Fix | Delete
* @since 5.5.0
[3391] Fix | Delete
*
[3392] Fix | Delete
* @global array $_wp_registered_theme_features
[3393] Fix | Delete
*
[3394] Fix | Delete
* @return array[] List of theme features, keyed by their name.
[3395] Fix | Delete
*/
[3396] Fix | Delete
function get_registered_theme_features() {
[3397] Fix | Delete
global $_wp_registered_theme_features;
[3398] Fix | Delete
[3399] Fix | Delete
if ( ! is_array( $_wp_registered_theme_features ) ) {
[3400] Fix | Delete
return array();
[3401] Fix | Delete
}
[3402] Fix | Delete
[3403] Fix | Delete
return $_wp_registered_theme_features;
[3404] Fix | Delete
}
[3405] Fix | Delete
[3406] Fix | Delete
/**
[3407] Fix | Delete
* Gets the registration config for a theme feature.
[3408] Fix | Delete
*
[3409] Fix | Delete
* @since 5.5.0
[3410] Fix | Delete
*
[3411] Fix | Delete
* @global array $_wp_registered_theme_features
[3412] Fix | Delete
*
[3413] Fix | Delete
* @param string $feature The feature name. See add_theme_support() for the list
[3414] Fix | Delete
* of possible values.
[3415] Fix | Delete
* @return array|null The registration args, or null if the feature was not registered.
[3416] Fix | Delete
*/
[3417] Fix | Delete
function get_registered_theme_feature( $feature ) {
[3418] Fix | Delete
global $_wp_registered_theme_features;
[3419] Fix | Delete
[3420] Fix | Delete
if ( ! is_array( $_wp_registered_theme_features ) ) {
[3421] Fix | Delete
return null;
[3422] Fix | Delete
}
[3423] Fix | Delete
[3424] Fix | Delete
return isset( $_wp_registered_theme_features[ $feature ] ) ? $_wp_registered_theme_features[ $feature ] : null;
[3425] Fix | Delete
}
[3426] Fix | Delete
[3427] Fix | Delete
/**
[3428] Fix | Delete
* Checks an attachment being deleted to see if it's a header or background image.
[3429] Fix | Delete
*
[3430] Fix | Delete
* If true it removes the theme modification which would be pointing at the deleted
[3431] Fix | Delete
* attachment.
[3432] Fix | Delete
*
[3433] Fix | Delete
* @access private
[3434] Fix | Delete
* @since 3.0.0
[3435] Fix | Delete
* @since 4.3.0 Also removes `header_image_data`.
[3436] Fix | Delete
* @since 4.5.0 Also removes custom logo theme mods.
[3437] Fix | Delete
* @since 6.6.0 Also removes `site_logo` option set by the site logo block.
[3438] Fix | Delete
*
[3439] Fix | Delete
* @param int $id The attachment ID.
[3440] Fix | Delete
*/
[3441] Fix | Delete
function _delete_attachment_theme_mod( $id ) {
[3442] Fix | Delete
$attachment_image = wp_get_attachment_url( $id );
[3443] Fix | Delete
$header_image = get_header_image();
[3444] Fix | Delete
$background_image = get_background_image();
[3445] Fix | Delete
$custom_logo_id = (int) get_theme_mod( 'custom_logo' );
[3446] Fix | Delete
$site_logo_id = (int) get_option( 'site_logo' );
[3447] Fix | Delete
[3448] Fix | Delete
if ( $custom_logo_id && $custom_logo_id === $id ) {
[3449] Fix | Delete
remove_theme_mod( 'custom_logo' );
[3450] Fix | Delete
remove_theme_mod( 'header_text' );
[3451] Fix | Delete
}
[3452] Fix | Delete
[3453] Fix | Delete
if ( $site_logo_id && $site_logo_id === $id ) {
[3454] Fix | Delete
delete_option( 'site_logo' );
[3455] Fix | Delete
}
[3456] Fix | Delete
[3457] Fix | Delete
if ( $header_image && $header_image === $attachment_image ) {
[3458] Fix | Delete
remove_theme_mod( 'header_image' );
[3459] Fix | Delete
remove_theme_mod( 'header_image_data' );
[3460] Fix | Delete
}
[3461] Fix | Delete
[3462] Fix | Delete
if ( $background_image && $background_image === $attachment_image ) {
[3463] Fix | Delete
remove_theme_mod( 'background_image' );
[3464] Fix | Delete
}
[3465] Fix | Delete
}
[3466] Fix | Delete
[3467] Fix | Delete
/**
[3468] Fix | Delete
* Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load.
[3469] Fix | Delete
*
[3470] Fix | Delete
* See {@see 'after_switch_theme'}.
[3471] Fix | Delete
*
[3472] Fix | Delete
* @since 3.3.0
[3473] Fix | Delete
*/
[3474] Fix | Delete
function check_theme_switched() {
[3475] Fix | Delete
$stylesheet = get_option( 'theme_switched' );
[3476] Fix | Delete
[3477] Fix | Delete
if ( $stylesheet ) {
[3478] Fix | Delete
$old_theme = wp_get_theme( $stylesheet );
[3479] Fix | Delete
[3480] Fix | Delete
// Prevent widget & menu mapping from running since Customizer already called it up front.
[3481] Fix | Delete
if ( get_option( 'theme_switched_via_customizer' ) ) {
[3482] Fix | Delete
remove_action( 'after_switch_theme', '_wp_menus_changed' );
[3483] Fix | Delete
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
[3484] Fix | Delete
update_option( 'theme_switched_via_customizer', false );
[3485] Fix | Delete
}
[3486] Fix | Delete
[3487] Fix | Delete
if ( $old_theme->exists() ) {
[3488] Fix | Delete
/**
[3489] Fix | Delete
* Fires on the next WP load after the theme has been switched.
[3490] Fix | Delete
*
[3491] Fix | Delete
* The parameters differ according to whether the old theme exists or not.
[3492] Fix | Delete
* If the old theme is missing, the old name will instead be the slug
[3493] Fix | Delete
* of the old theme.
[3494] Fix | Delete
*
[3495] Fix | Delete
* See {@see 'switch_theme'}.
[3496] Fix | Delete
*
[3497] Fix | Delete
* @since 3.3.0
[3498] Fix | Delete
*
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function