Server IP : 162.213.251.212 / Your IP : 3.144.43.95 [ Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/allssztx/bestvalleywater.com/wp-content/themes/extendable/ |
Upload File : |
<?php /** * Extendable functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Extendable * @since Extendable 1.0 */ if ( ! function_exists( 'extendable_support' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * @since Extendable 1.0 * * @return void */ function extendable_support() { // Add support for block styles. add_theme_support( 'wp-block-styles' ); global $wp_version; // Add style for WordPress older versions. if ( version_compare( $wp_version, '6.0.2', '<=' ) ) { $editor_style = array( 'style.css', '/assets/css/deprecate-style.css', ); } else { $editor_style = 'style.css'; } // Enqueue editor styles. add_editor_style( $editor_style ); } endif; add_action( 'after_setup_theme', 'extendable_support' ); if ( ! function_exists( 'extendable_styles' ) ) : /** * Enqueue styles. * * @since Extendable 1.0 * * @return void */ function extendable_styles() { // Register theme stylesheet. $theme_version = wp_get_theme()->get( 'Version' ); $version_string = is_string( $theme_version ) ? $theme_version : false; wp_register_style( 'extendable-style', get_template_directory_uri() . '/style.css', array(), $version_string ); // Enqueue theme stylesheet. wp_enqueue_style( 'extendable-style' ); global $wp_version; if ( version_compare( $wp_version, '6.0.2', '<=' ) ) { // Register deprecate stylesheet. wp_register_style( 'extendable-deprecate-style', get_template_directory_uri() . '/assets/css/deprecate-style.css', array(), $version_string ); // Enqueue deprecate stylesheet. wp_enqueue_style( 'extendable-deprecate-style' ); } } endif; add_action( 'wp_enqueue_scripts', 'extendable_styles' ); /** * Enqueue block-specific styles. * * @since Extendable 2.0.11 * * @return void */ function extendable_enqueue_block_styles() { // Check for specific blocks and enqueue their styles if ( has_block( 'contact-form-7/contact-form-selector' ) ) { wp_enqueue_style( 'extendable-contact-form-7-style', get_template_directory_uri() . '/assets/css/contact-form-7.css', array(), '1.0.0' ); } if ( has_block( 'wpforms/form-selector' ) ) { wp_enqueue_style( 'extendable-wpforms-style', get_template_directory_uri() . '/assets/css/wpforms.css', array(), '1.0.0' ); } } add_action( 'enqueue_block_assets', 'extendable_enqueue_block_styles' ); /** * Registers pattern categories. * * @since Extendable 1.0 * * @return void */ function extendable_register_pattern_categories() { $block_pattern_categories = array( 'header' => array( 'label' => __( 'Headers', 'extendable' ) ), 'footer' => array( 'label' => __( 'Footers', 'extendable' ) ), ); /** * Filters the theme block pattern categories. * * @since Extendable 1.0 * * @param array[] $block_pattern_categories { * An associative array of block pattern categories, keyed by category name. * * @type array[] $properties { * An array of block category properties. * * @type string $label A human-readable label for the pattern category. * } * } */ $block_pattern_categories = apply_filters( 'extendable_block_pattern_categories', $block_pattern_categories ); foreach ( $block_pattern_categories as $name => $properties ) { if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) { register_block_pattern_category( $name, $properties ); } } } add_action( 'init', 'extendable_register_pattern_categories', 9 ); /** * Enqueue dynamic CSS for primary-foreground duotone filter. * * Ensure default logo works well on light and dark backgrounds * * @since Extendable 2.0.11 * * @return void */ function enqueue_dynamic_duotone_css() { $theme_json = WP_Theme_JSON_Resolver::get_merged_data(); $duotone_presets = $theme_json->get_settings()['color']['duotone']['theme'] ?? []; $preset_index = array_search( 'primary-foreground', array_column( $duotone_presets, 'slug' ) ); $primary_color = '#000000'; $foreground_color = '#ffffff'; if ( false !== $preset_index ) { $primary_color = $duotone_presets[ $preset_index ]['colors'][0]; $foreground_color = $duotone_presets[ $preset_index ]['colors'][1]; } list( $r, $g, $b ) = array_map( fn( $c ) => hexdec( $c ) / 255, sscanf( $primary_color, "#%02x%02x%02x" ) ); $css = " .wp-block-site-logo img[src*='extendify-demo-'] { filter: url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\"><filter id=\"solid-color\"><feColorMatrix color-interpolation-filters=\"sRGB\" type=\"matrix\" values=\"0 0 0 0 {$r} 0 0 0 0 {$g} 0 0 0 0 {$b} 0 0 0 1 0\"/></filter></svg>#solid-color') !important; } "; wp_add_inline_style( 'wp-block-library', $css ); } add_action( 'wp_enqueue_scripts', 'enqueue_dynamic_duotone_css' );