File: /www/wwwroot/www.movieloversky.com/wp-content/themes/daami/inc/customizer.php
<?php
/**
* daami Theme Customizer
*
* @package Daami
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function daami_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title a',
'render_callback' => 'daami_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'render_callback' => 'daami_customize_partial_blogdescription',
)
);
}
/*
* Theme Options Panel
*/
$wp_customize->add_panel('daami_panel', array(
'priority' => 25,
'capability' => 'edit_theme_options',
'title' => __('Daami Theme Options', 'daami'),
));
/*
* Customizer top header section
*/
/*Top Header Options*/
$wp_customize->add_section('daami_header_section', array(
'priority' => 5,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __('Top Header Options', 'daami'),
'panel' => 'daami_panel',
));
/*Top header section enable*/
$wp_customize->add_setting(
'daami_enable_top_header',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 1,
'sanitize_callback' => 'daami_sanitize_checkbox',
)
);
$wp_customize->add_control(
'daami_enable_top_header',
array(
'label' => __('Enable Top Header', 'daami'),
'description' => __('Checked to show the top header section.', 'daami'),
'section' => 'daami_header_section',
'type' => 'checkbox',
)
);
/*Enable Menu at the top*/
$wp_customize->add_setting(
'daami_enable_top_menu',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 1,
'sanitize_callback' => 'daami_sanitize_checkbox',
)
);
$wp_customize->add_control(
'daami_enable_top_menu',
array(
'label' => __('Enable Top Menu', 'daami'),
'description' => __('Top menu will be enabled from here.', 'daami'),
'section' => 'daami_header_section',
'type' => 'checkbox',
)
);
/*Enable Social Menu at the top*/
$wp_customize->add_setting(
'daami_enable_top_social_menu',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 1,
'sanitize_callback' => 'daami_sanitize_checkbox',
)
);
$wp_customize->add_control(
'daami_enable_top_social_menu',
array(
'label' => __('Enable Top Social Menu', 'daami'),
'description' => __('Checked to show the top social menu.', 'daami'),
'section' => 'daami_header_section',
'type' => 'checkbox',
)
);
/*Enable Search Icon at the top*/
$wp_customize->add_setting(
'daami_enable_top_search_icon',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 1,
'sanitize_callback' => 'daami_sanitize_checkbox',
)
);
$wp_customize->add_control(
'daami_enable_top_search_icon',
array(
'label' => __('Enable Top Search Section', 'daami'),
'description' => __('Checked to show the Search icon.', 'daami'),
'section' => 'daami_header_section',
'type' => 'checkbox',
)
);
/*
* Customizer Footer Section
*/
/*Footer Options*/
$wp_customize->add_section('daami_footer_section', array(
'priority' => 5,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __('Footer Options', 'daami'),
'panel' => 'daami_panel',
));
/*Footer Social Menu Option*/
$wp_customize->add_setting(
'daami_footer_social_menu',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 1,
'sanitize_callback' => 'daami_sanitize_checkbox',
)
);
$wp_customize->add_control(
'daami_footer_social_menu',
array(
'label' => __('Enable Footer Social Menu', 'daami'),
'description' => __('Checked to show the Footer Social Menu.', 'daami'),
'section' => 'daami_footer_section',
'type' => 'checkbox',
)
);
/*Footer Copyright Text Enable*/
$wp_customize->add_setting(
'daami_copyright_option',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'Copyright All Rights Reserved 2023',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'daami_copyright_option',
array(
'label' => __('Edit Copyright Text', 'daami'),
'description' => __('Edit the Footer Copyright Section.', 'daami'),
'section' => 'daami_footer_section',
'type' => 'text',
)
);
/*Go To Top Option*/
$wp_customize->add_setting(
'daami_enable_go_to_top_option',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 1,
'sanitize_callback' => 'daami_sanitize_checkbox',
)
);
$wp_customize->add_control(
'daami_enable_go_to_top_option',
array(
'label' => __('Enable Go To Top', 'daami'),
'description' => __('Checked to enable Go To Top option.', 'daami'),
'section' => 'daami_footer_section',
'type' => 'checkbox',
)
);
/*Extra Options*/
$wp_customize->add_section('daami_extra_section', array(
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __('Extra Options', 'daami'),
'panel' => 'daami_panel',
));
/*Breadcrumb settings*/
$wp_customize->add_setting(
'daami_breadcrumb_options',
array(
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'default' => 'disable',
'sanitize_callback' => 'daami_sanitize_select'
)
);
$wp_customize->add_control('daami_breadcrumb_options', array(
'choices' => array(
'disable' => __('Disable Breadcrumb', 'daami'),
'rank-math' => __('Rank Math Breadcrumb', 'daami'),
'yoast-seo' => __('Yoast SEO Breadcrumb', 'daami'),
),
'label' => __('Breadcrumb Option in Single and Blog Page', 'daami'),
'description' => __('You can use any of the breadcrumb from the option. You need to install and activate Yoast or Rank Math plugin. ', 'daami'),
'section' => 'daami_extra_section',
'settings' => 'daami_breadcrumb_options',
'type' => 'select',
));
}
add_action( 'customize_register', 'daami_customize_register' );
/**
* Render the site title for the selective refresh partial.
*
* @return void
*/
function daami_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
*
* @return void
*/
function daami_customize_partial_blogdescription() {
bloginfo( 'description' );
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function daami_customize_preview_js() {
wp_enqueue_script( 'daami-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), _S_VERSION, true );
}
add_action( 'customize_preview_init', 'daami_customize_preview_js' );