__( 'Overlay Menu', 'best-blogger' ),
) );
}
add_action( 'after_setup_theme', 'best_blogger_setup' );
/**
* [best_blogger_styles_scripts add CSS and JS - wp_enqueue_scripts]
* @return [type] [description]
*/
function best_blogger_styles_scripts() {
$dependency = array( 'bootstrap', 'font-awesome', 'di-blog-style-default', 'di-blog-style-core' );
if( class_exists( 'WooCommerce' ) ) {
$dependency = array( 'bootstrap', 'font-awesome', 'di-blog-style-default', 'di-blog-style-core', 'di-blog-style-woo' );
}
/**
* Add the default/main css file of parent theme.
*/
wp_enqueue_style( 'di-blog-style-default', get_template_directory_uri() . '/style.css' );
/**
* Add the main css file of the child theme after all css files of parent theme.
*/
wp_enqueue_style( 'best-blogger', get_stylesheet_directory_uri() . '/style.css', $dependency, wp_get_theme()->get('Version'), 'all' );
// Load overlay-menu.js if overlay menu enabled in customize
if( get_theme_mod( 'ovrly_menu_endis', '1' ) == 1 ) {
wp_enqueue_script( 'best-blogger-overlay-menu', get_stylesheet_directory_uri() . '/assets/js/overlay-menu.js', array( 'jquery' ), wp_get_theme()->get('Version'), true );
}
}
add_action( 'wp_enqueue_scripts', 'best_blogger_styles_scripts' );
/**
* [best_blogger_customize_pr_handle description]
* @param [type] $wp_customize [description]
* @return [type] [description]
*/
function best_blogger_customize_pr_handle( $wp_customize ) {
$wp_customize->get_setting( 'ovrly_menu_ttl_attr' )->transport = 'refresh';
$wp_customize->selective_refresh->add_partial( 'ovrly_menu_ttl_attr', array(
'selector' => '.ovrly-menu-otr',
) );
$wp_customize->get_setting( 'best_blogger_cta_label' )->transport = 'refresh';
$wp_customize->selective_refresh->add_partial( 'best_blogger_cta_label', array(
'selector' => '.di-cta-otr',
) );
}
add_action( 'customize_register', 'best_blogger_customize_pr_handle', 9999999 );
/**
* [best_blogger_customizer_scripts_and_styles description]
* @return [type] [description]
*/
function best_blogger_customizer_scripts_and_styles() {
wp_enqueue_style( 'best-blogger-customize-preview', get_stylesheet_directory_uri() . '/assets/css/customizer.css', array( 'customize-preview', 'di-blog-customize-preview' ), wp_get_theme()->get('Version'), 'all' );
}
add_action( 'customize_preview_init', 'best_blogger_customizer_scripts_and_styles' );
/**
* [best_blogger_customizer_options options to di_blog_after_typo]
* @return [type] [description]
*/
function best_blogger_customizer_options(){
// Overlay Menu
Kirki::add_section( 'ovrly_menu', array(
'title' => esc_html__( 'Overlay Menu', 'best-blogger' ),
'panel' => 'di_blog_options',
'capability' => 'edit_theme_options',
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'toggle',
'settings' => 'ovrly_menu_endis',
'label' => esc_html__( 'Overlay Menu', 'best-blogger' ),
'description' => esc_html__( 'Turn on to enable Overlay menu', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => '1',
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'custom',
'settings' => 'ovrly_menu_info',
'label' => '',
'section' => 'ovrly_menu',
'default' => '
',
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'text',
'settings' => 'ovrly_menu_ttl_attr',
'label' => esc_html__( 'Title', 'best-blogger' ),
'description' => esc_html__( 'Title of the menu icon', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => esc_html__( 'Overlay Menu', 'best-blogger' ),
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'color',
'settings' => 'ovrly_menu_clr',
'label' => esc_html__( 'Links Color', 'best-blogger' ),
'description' => esc_html__( 'Color of the menu items', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => '#cea525',
'choices' => array(
'alpha' => true,
),
'output' => array(
array(
'element' => 'ul.overlaymenu-class li a, .ovrly .ovrly-menu-closebtn',
'property' => 'color',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'color',
'settings' => 'ovrly_menu_hvr_clr',
'label' => esc_html__( 'Links Hover Color', 'best-blogger' ),
'description' => esc_html__( 'Hover color of the menu items', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => '#f1f1f1',
'choices' => array(
'alpha' => true,
),
'output' => array(
array(
'element' => 'ul.overlaymenu-class li a:hover, ul.overlaymenu-class li a:focus, .ovrly .ovrly-menu-closebtn:hover',
'property' => 'color',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'background',
'settings' => 'ovrly_menu_bg',
'label' => esc_html__( 'Background Property', 'best-blogger' ),
'description' => esc_html__( 'Display background color or image.', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => array(
'background-color' => '',
'background-image' => esc_url( get_stylesheet_directory_uri() . '/assets/images/overlay-bg.webp' ),
'background-repeat' => 'no-repeat',
'background-position' => 'center center',
'background-size' => 'cover',
'background-attachment' => 'fixed',
),
'transport' => 'auto',
'output' => array(
array(
'element' => '.ovrly',
),
),
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'color',
'settings' => 'ovrly_menu_bg_overlay',
'label' => esc_html__( 'Background Image Overlay Color', 'best-blogger' ),
'description' => esc_html__( 'This color will apply over the background image.', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => 'rgba(0,0,0, 0.3)',
'choices' => array(
'alpha' => true,
),
'output' => array(
array(
'element' => '.overlay-bgoverlay-color',
'property' => 'background-color',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'typography',
'settings' => 'ovrly_menu_typog',
'label' => esc_html__( 'Typography', 'best-blogger' ),
'description' => esc_html__( 'Typography of the menu items', 'best-blogger' ),
'section' => 'ovrly_menu',
'default' => array(
'font-family' => 'Lora',
'variant' => 'regular',
'font-size' => '36px',
'letter-spacing' => '0px',
'text-transform' => 'inherit',
),
'output' => array(
array(
'element' => 'ul.overlaymenu-class li',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'ovrly_menu_endis',
'operator' => '==',
'value' => '1',
),
),
) );
// CTA
Kirki::add_section( 'best_blogger_cta', array(
'title' => esc_html__( 'CTA Options', 'best-blogger' ),
'panel' => 'di_blog_options',
'capability' => 'edit_theme_options',
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'toggle',
'settings' => 'best_blogger_cta_endis',
'label' => esc_html__( 'CTA Feature', 'best-blogger' ),
'description' => esc_html__( 'Turn on to enable CTA', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => '1',
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'text',
'settings' => 'best_blogger_cta_label',
'label' => esc_html__( 'Label', 'best-blogger' ),
'description' => esc_html__( 'Label of CTA', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => esc_html__( 'Get Started', 'best-blogger' ),
'active_callback' => array(
array(
'setting' => 'best_blogger_cta_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'url',
'settings' => 'best_blogger_cta_link',
'label' => esc_html__( 'Link', 'best-blogger' ),
'description' => esc_html__( 'Link of CTA', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => esc_url( home_url( '/' ) ),
'active_callback' => array(
array(
'setting' => 'best_blogger_cta_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'toggle',
'settings' => 'best_blogger_cta_link_trgt',
'label' => esc_html__( 'Link Target', 'best-blogger' ),
'description' => esc_html__( 'Turn on to open link in new tab.', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => '0',
'active_callback' => array(
array(
'setting' => 'best_blogger_cta_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'color',
'settings' => 'best_blogger_cta_clr',
'label' => esc_html__( 'Color', 'best-blogger' ),
'description' => esc_html__( 'Color of the CTA button', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => '#cea525',
'choices' => array(
'alpha' => true,
),
'output' => array(
array(
'element' => '.di-cta-otr .cta-inner',
'property' => 'color',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'best_blogger_cta_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'color',
'settings' => 'best_blogger_cta_hvr_clr',
'label' => esc_html__( 'Hover Color', 'best-blogger' ),
'description' => esc_html__( 'Hover color of the CTA button', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => '#9a7918',
'choices' => array(
'alpha' => true,
),
'output' => array(
array(
'element' => '.di-cta-otr .cta-inner:hover',
'property' => 'color',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'best_blogger_cta_endis',
'operator' => '==',
'value' => '1',
),
),
) );
Kirki::add_field( 'di_blog_config', array(
'type' => 'typography',
'settings' => 'best_blogger_cta_typog',
'label' => esc_html__( 'Typography', 'best-blogger' ),
'description' => esc_html__( 'Typography of the CTA button', 'best-blogger' ),
'section' => 'best_blogger_cta',
'default' => array(
'font-family' => 'Lora',
'variant' => 'regular',
'font-size' => '14px',
'line-height' => '0',
'letter-spacing' => '1px',
'text-transform' => 'capitalize',
),
'output' => array(
array(
'element' => '.di-cta-otr .cta-inner',
),
),
'transport' => 'auto',
'active_callback' => array(
array(
'setting' => 'best_blogger_cta_endis',
'operator' => '==',
'value' => '1',
),
),
) );
}
add_action( 'di_blog_after_typo', 'best_blogger_customizer_options' );