HEX
Server: Microsoft-IIS/10.0
System: Windows NT WIN8095 10.0 build 20348 (Windows Server 2016) AMD64
User: kytoffice-001 (0)
PHP: 7.4.30
Disabled: exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,show_source
Upload Files
File: h:/root/home/kytoffice-001/www/expresstinou/wp-content/themes/graceful-zen-blog/functions.php
<?php
/**
 * Graceful Zen Blog functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Graceful Zen Blog
 */

// ----------------------------------------------------------------------------------
//	Register Front-End Styles And Scripts
// ----------------------------------------------------------------------------------

function graceful_zen_blog_enqueue_child_styles() {
 
    wp_enqueue_style( 'graceful-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'graceful-zen-blog-style', get_stylesheet_directory_uri() . '/style.css', array( 'graceful-style' ), wp_get_theme()->get('Version') );
}
add_action( 'wp_enqueue_scripts', 'graceful_zen_blog_enqueue_child_styles' );


// Load after Theme Setup
function graceful_zen_blog_theme_setup() {
    
    // ----------------------------------------------------------------------------------
    //  Customize Register
    // ----------------------------------------------------------------------------------
    function graceful_zen_blog_customize_register( $wp_customize ) {    

        /** Special Links */
        // Special Links section
        $wp_customize->add_section( 'graceful_zen_blog_special_links' , array(
            'title'      => esc_html__( 'Zen Special Links', 'graceful-zen-blog' ),
            'priority'   => 28,
            'capability' => 'edit_theme_options'
        ) );

        // Special Links 1
        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_show]', array(
            'default'    => graceful_zen_blog_options( 'special_links_show' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'graceful_sanitize_checkboxes'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_show]', array(
            'label'     => esc_html__( 'Enable Special Links', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'checkbox',
            'priority'  => 1
        ) );


        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_title_1]', array(
            'default'    => graceful_zen_blog_options( 'special_links_title_1' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_text_field'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_title_1]', array(
            'label'     => esc_html__( 'Title 1', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 9
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_url_1]', array(
            'default'    => graceful_zen_blog_options( 'special_links_url_1' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'esc_url_raw'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_url_1]', array(
            'label'     => esc_html__( 'URL 1', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 11
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_image_1]', array(
            'default'   => '',
            'type'      => 'option',
            'transport' => 'refresh',
            'sanitize_callback' => 'graceful_sanitize_number_absint'
        ) );
        $wp_customize->add_control(
            new WP_Customize_Cropped_Image_Control( $wp_customize, 'graceful_zen_blog_options[special_links_image_1]', array(
                'label'         => esc_html__( 'Image 1', 'graceful-zen-blog' ),
                'section'       => 'graceful_zen_blog_special_links',
                'flex_width'    => false,
                'flex_height'   => false,
                'width'         => 600,
                'height'        => 340,
                'priority'      => 13
            )
        ) );

        // Special Links Enable
        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_show]', array(
            'default'    => graceful_zen_blog_options( 'special_links_show' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'graceful_sanitize_checkboxes'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_show]', array(
            'label'     => esc_html__( 'Enable Special Links', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'checkbox',
            'priority'  => 1
        ) );

        // Special Links 1
        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_title_1]', array(
            'default'    => graceful_zen_blog_options( 'special_links_title_1' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_text_field'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_title_1]', array(
            'label'     => esc_html__( 'Title 1', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 9
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_url_1]', array(
            'default'    => graceful_zen_blog_options( 'special_links_url_1' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'esc_url_raw'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_url_1]', array(
            'label'     => esc_html__( 'URL 1', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 11
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_image_1]', array(
            'default'   => '',
            'type'      => 'option',
            'transport' => 'refresh',
            'sanitize_callback' => 'graceful_sanitize_number_absint'
        ) );
        $wp_customize->add_control(
            new WP_Customize_Cropped_Image_Control( $wp_customize, 'graceful_zen_blog_options[special_links_image_1]', array(
                'label'         => esc_html__( 'Image 1', 'graceful-zen-blog' ),
                'section'       => 'graceful_zen_blog_special_links',
                'flex_width'    => false,
                'flex_height'   => false,
                'width'         => 600,
                'height'        => 340,
                'priority'      => 13
            )
        ) );

        // Special Links 2
        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_title_2]', array(
            'default'    => graceful_zen_blog_options( 'special_links_title_2' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_text_field'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_title_2]', array(
            'label'     => esc_html__( 'Title 2', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 15
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_url_2]', array(
            'default'    => graceful_zen_blog_options( 'special_links_url_2' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'esc_url_raw'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_url_2]', array(
            'label'     => esc_html__( 'URL 2', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 17
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_image_2]', array(
            'default'   => '',
            'type'      => 'option',
            'transport' => 'refresh',
            'sanitize_callback' => 'graceful_sanitize_number_absint'
        ) );
        $wp_customize->add_control(
            new WP_Customize_Cropped_Image_Control( $wp_customize, 'graceful_zen_blog_options[special_links_image_2]', array(
                'label'         => esc_html__( 'Image 2', 'graceful-zen-blog' ),
                'section'       => 'graceful_zen_blog_special_links',
                'flex_width'    => false,
                'flex_height'   => false,
                'width'         => 600,
                'height'        => 340,
                'priority'      => 19
            )
        ) );

        // Special Links 3
        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_title_3]', array(
            'default'    => graceful_zen_blog_options( 'special_links_title_3' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_text_field'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_title_3]', array(
            'label'     => esc_html__( 'Title 3', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 21
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_url_3]', array(
            'default'    => graceful_zen_blog_options( 'special_links_url_3' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'esc_url_raw'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_url_3]', array(
            'label'     => esc_html__( 'URL 3', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_blog_special_links',
            'type'      => 'text',
            'priority'  => 23
        ) );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_image_3]', array(
            'default'   => '',
            'type'      => 'option',
            'transport' => 'refresh',
            'sanitize_callback' => 'graceful_sanitize_number_absint'
        ) );
        $wp_customize->add_control(
            new WP_Customize_Cropped_Image_Control( $wp_customize, 'graceful_zen_blog_options[special_links_image_3]', array(
                'label'         => esc_html__( 'Image 3', 'graceful-zen-blog' ),
                'section'       => 'graceful_zen_blog_special_links',
                'flex_width'    => false,
                'flex_height'   => false,
                'width'         => 600,
                'height'        => 340,
                'priority'      => 25
            )
        ) );

        // Special Links Layout Width
        $boxed_width_special_links = array(
            'full' => esc_html__( 'Full', 'graceful-zen-blog' ),
            'wrapped' => esc_html__( 'Boxed', 'graceful-zen-blog' ),
        );

        $wp_customize->add_setting( 'graceful_zen_blog_options[special_links_width]', array(
            'default'    => graceful_zen_blog_options( 'special_links_width' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'graceful_sanitize_select'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[special_links_width]', array(
            'label'         => esc_html__( 'Special Links Width', 'graceful-zen-blog' ),
            'section'       => 'graceful_basic',
            'type'          => 'select',
            'choices'       => $boxed_width_special_links,
            'priority'      => 28
        ) );

        // Top Navigation section
        $wp_customize->add_section( 'graceful_top_navigation' , array(
            'title'      => esc_html__( 'Top Navigation', 'graceful-zen-blog' ),
            'priority'   => 23,
            'capability' => 'edit_theme_options'
        ) );

        // Enable Top Navigation
        $wp_customize->add_setting( 'graceful_zen_blog_options[top_navigation_show]', array(
            'default'    => graceful_zen_blog_options('top_navigation_show'),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'graceful_sanitize_checkboxes'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[top_navigation_show]', array(
            'label'     => esc_html__( 'Enable Top Navigation', 'graceful-zen-blog' ),
            'section'   => 'graceful_top_navigation',
            'type'      => 'checkbox',
            'priority'  => 1
        ) );

        // Top Navigation Background Color
        $wp_customize->add_setting( 'graceful_zen_blog_options[top_navigation_bg]', array(
            'default'    => graceful_zen_blog_options('top_navigation_bg'),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_hex_color'
        ) );
        $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'graceful_zen_blog_options[top_navigation_bg]', array(
            'label'     => esc_html__( 'Top Navigation Background Color', 'graceful-zen-blog' ),
            'section'   => 'graceful_top_navigation',
            'priority'  => 3
        ) ) );

        // Top Navigation Text Color
        $wp_customize->add_setting( 'graceful_zen_blog_options[top_navigation_text_color]', array(
            'default'    => graceful_zen_blog_options('top_navigation_text_color'),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_hex_color'
        ) );
        $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'graceful_zen_blog_options[top_navigation_text_color]', array(
            'label'     => esc_html__( 'Top Navigation Text Color', 'graceful-zen-blog' ),
            'section'   => 'graceful_top_navigation',
            'priority'  => 5
        ) ) );


        /** Zen Post Slider Section */
        // Add Zen Post Slider Section
        $wp_customize->add_section( 'graceful_zen_post_slider' , array(
            'title'      => esc_html__( 'Zen Post Slider', 'graceful-zen-blog' ),
            'priority'   => 26,
            'capability' => 'edit_theme_options'
        ) );

        // Enable Latest Post Section
        $wp_customize->add_setting( 'graceful_zen_blog_options[zen_post_slider_show]', array(
            'default'    => graceful_zen_blog_options( 'zen_post_slider_show' ),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'graceful_sanitize_checkboxes'
        ) );
        $wp_customize->add_control( 'graceful_zen_blog_options[zen_post_slider_show]', array(
            'label'     => esc_html__( 'Enable Zen Post Slider', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_post_slider',
            'type'      => 'checkbox',
            'priority'  => 1
        ) );

        // Zen Accent Colors
        $wp_customize->add_section( 'graceful_zen_accent' , array(
            'title'      => esc_html__( 'Zen Accent Color', 'graceful-zen-blog' ),
            'priority'   => 27,
            'capability' => 'edit_theme_options'
        ) );
        $wp_customize->add_setting( 'graceful_zen_blog_options[zen_accent_color]', array(
            'default'    => graceful_zen_blog_options('zen_accent_color'),
            'type'       => 'option',
            'transport'  => 'refresh',
            'capability' => 'edit_theme_options',
            'sanitize_callback' => 'sanitize_hex_color'
        ) );
        $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'graceful_zen_blog_options[zen_accent_color]', array(
            'label'     => esc_html__( 'Choose the Accent Color', 'graceful-zen-blog' ),
            'section'   => 'graceful_zen_accent',
            'priority'  => 3
        ) ) );

    }
    add_action( 'customize_register', 'graceful_zen_blog_customize_register', 99 );

    // Sanitize number absint
    function graceful_sanitize_number_absint( $number, $setting ) {

        // ensure $number is an absolute integer
        $number = absint( $number );

        // return default if not integer
        return ( $number ? $number : $setting->default );

    }

    // Register Top Menu
    register_nav_menus(
        array(
            'top'  => esc_html__( 'Top Menu', 'graceful-zen-blog' ),
        )
    );

    function graceful_top_menu_fallback() {
        if ( current_user_can( 'edit_theme_options' ) ) {
            ?>
            <ul id="top-menu">
                <li>
                    <a href="<?php echo esc_url( home_url( '/wp-admin/nav-menus.php') ) ?>">
                        <?php esc_html_e( 'Set-up Top Menu', 'graceful-zen-blog' ) ?>
                    </a>
                </li>
            </ul>
            <?php
        }
    }

    // Enqueue customizer styles
    function graceful_zen_blog_customizer_css() {
        wp_enqueue_style( 'graceful-customize-style', get_theme_file_uri( '/css/customize-ui.css' ) );
    }
    add_action( 'customize_controls_enqueue_scripts', 'graceful_zen_blog_customizer_css' );

    // Graceful Zen Blog Blog default options
    function graceful_zen_blog_options( $controls ) {

        $graceful_zen_blog_defaults = array(
            'zen_accent_color' => '#16b7cc',
            'zen_post_slider_show' => true,
            'top_navigation_show' => true,
            'top_navigation_bg' => '#16b7cc',
            'top_navigation_text_color' => '#ffffff',
            'blog_grid_excerpt_length' => '15',
            'special_links_show' => false,
            'special_links_window' => true,
            'special_links_width' => 'full',
            'special_links_title_1' => '',
            'special_links_url_1' => '',
            'special_links_image_1' => '',
            'special_links_title_2' => '',
            'special_links_url_2' => '',
            'special_links_image_2' => '',
            'special_links_title_3' => '',
            'special_links_url_3' => '',
            'special_links_image_3' => '',
        );

        // merge defaults and options
        $graceful_zen_blog_defaults = wp_parse_args( get_option( 'graceful_zen_blog_options' ), $graceful_zen_blog_defaults );

        // return control
        return $graceful_zen_blog_defaults[ $controls ];

    }

}
add_action( 'after_setup_theme', 'graceful_zen_blog_theme_setup' );
// ----------------------------------------------------------------------------------
//  New Thumbnail Size
// ----------------------------------------------------------------------------------
if ( function_exists( 'add_image_size' ) ) {
    // new column thumbnail size
    add_image_size( 'graceful-post-column-thumbnail', 700, 680, true );
}

// ----------------------------------------------------------------------------------
//  New Font
// ----------------------------------------------------------------------------------
function graceful_zen_blog_enqueue_assets()
{
    // Include the file.
    require_once get_theme_file_path('webfont-loader/wptt-webfont-loader.php');
    // Load the webfont.
    wp_enqueue_style(
        'minimalist-stories-fonts',
        wptt_get_webfont_url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=auto'),
        array(),
        '1.0'
    );
}
add_action('wp_enqueue_scripts', 'graceful_zen_blog_enqueue_assets');