'ffffff',
'default-image' => '',
'default-repeat' => 'repeat',
'default-position-x' => 'left',
'default-position-y' => 'top',
'default-size' => 'auto',
'default-attachment' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => ''
)
);
}
/**
* Overwrite theme URL
*
*/
function lalita_theme_uri_link() {
return 'https://wpkoi.com/ashram-wpkoi-wordpress-theme/';
}
/**
* Overwrite parent theme's blog header function
*
*/
add_action( 'lalita_after_header', 'lalita_blog_header_image', 11 );
function lalita_blog_header_image() {
if ( ( is_front_page() && is_home() ) || ( is_home() ) ) {
$blog_header_image = lalita_get_setting( 'blog_header_image' );
$blog_header_title = lalita_get_setting( 'blog_header_title' );
$blog_header_text = lalita_get_setting( 'blog_header_text' );
$blog_header_button_text = lalita_get_setting( 'blog_header_button_text' );
$blog_header_button_url = lalita_get_setting( 'blog_header_button_url' );
if ( $blog_header_image != '' ) { ?>
add_setting(
'ashram_settings[nav_btn_text]',
array(
'default' => '',
'type' => 'option',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control(
'ashram_settings[nav_btn_text]',
array(
'type' => 'text',
'label' => __( 'Extra button text', 'ashram' ),
'section' => 'lalita_layout_navigation',
'settings' => 'ashram_settings[nav_btn_text]',
'priority' => 25
)
);
// Add navigation extra button url
$wp_customize->add_setting(
'ashram_settings[nav_btn_url]',
array(
'default' => '',
'type' => 'option',
'sanitize_callback' => 'esc_url'
)
);
$wp_customize->add_control(
'ashram_settings[nav_btn_url]',
array(
'type' => 'text',
'label' => __( 'Extra button URL', 'ashram' ),
'section' => 'lalita_layout_navigation',
'settings' => 'ashram_settings[nav_btn_url]',
'priority' => 25
)
);
// Navigation effect
$wp_customize->add_setting(
'ashram_settings[nav_effect]',
array(
'default' => 'enable',
'type' => 'option',
'sanitize_callback' => 'ashram_sanitize_choices'
)
);
$wp_customize->add_control(
'ashram_settings[nav_effect]',
array(
'type' => 'select',
'label' => __( 'Ashram navigation effect', 'ashram' ),
'choices' => array(
'enable' => __( 'Enable', 'ashram' ),
'disable' => __( 'Disable', 'ashram' )
),
'settings' => 'ashram_settings[nav_effect]',
'section' => 'lalita_layout_navigation',
'priority' => 24
)
);
// Blog image effect
$wp_customize->add_setting(
'ashram_settings[img_effect]',
array(
'default' => 'enable',
'type' => 'option',
'sanitize_callback' => 'ashram_sanitize_choices'
)
);
$wp_customize->add_control(
'ashram_settings[img_effect]',
array(
'type' => 'select',
'label' => __( 'Blog image effect', 'ashram' ),
'choices' => array(
'enable' => __( 'Enable', 'ashram' ),
'disable' => __( 'Disable', 'ashram' )
),
'settings' => 'ashram_settings[img_effect]',
'section' => 'lalita_blog_section',
'priority' => 29
)
);
// Nicescroll
$wp_customize->add_setting(
'ashram_settings[nicescroll]',
array(
'default' => 'enable',
'type' => 'option',
'sanitize_callback' => 'ashram_sanitize_choices'
)
);
$wp_customize->add_control(
'ashram_settings[nicescroll]',
array(
'type' => 'select',
'label' => __( 'Scrollbar style', 'ashram' ),
'choices' => array(
'enable' => __( 'Enable', 'ashram' ),
'disable' => __( 'Disable', 'ashram' )
),
'settings' => 'ashram_settings[nicescroll]',
'section' => 'lalita_layout_container',
'priority' => 20
)
);
// Cursor
$wp_customize->add_setting(
'ashram_settings[cursor]',
array(
'default' => 'enable',
'type' => 'option',
'sanitize_callback' => 'ashram_sanitize_choices'
)
);
$wp_customize->add_control(
'ashram_settings[cursor]',
array(
'type' => 'select',
'label' => __( 'Cursor image', 'ashram' ),
'choices' => array(
'enable' => __( 'Enable', 'ashram' ),
'disable' => __( 'Disable', 'ashram' )
),
'settings' => 'ashram_settings[cursor]',
'section' => 'lalita_layout_container',
'priority' => 20
)
);
}
}
if ( ! function_exists( 'ashram_navigation_button' ) ) {
add_filter( 'wp_nav_menu_items', 'ashram_navigation_button', 11, 2 );
/**
* Add the extra button to the navigation.
*
*/
function ashram_navigation_button( $nav, $args ) {
// Get Customizer settings
$ashram_settings = get_option( 'ashram_settings' );
// If our primary menu is set, add the extra button.
if ( ( isset( $ashram_settings['nav_btn_url'] ) ) && ( isset( $ashram_settings['nav_btn_text'] ) ) && ( isset( $args->theme_location ) ) ) {
if ( ( $args->theme_location == 'primary' ) && ( $ashram_settings['nav_btn_url'] != '' ) ) {
return $nav . '' . esc_html( $ashram_settings['nav_btn_text'] ) . '';
}
}
return $nav;
}
}
if ( ! function_exists( 'ashram_sanitize_choices' ) ) {
/**
* Sanitize choices.
*
*/
function ashram_sanitize_choices( $input, $setting ) {
// Ensure input is a slug
$input = sanitize_key( $input );
// Get list of choices from the control
// associated with the setting
$choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it;
// otherwise, return the default
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
}
if ( ! function_exists( 'ashram_body_classes' ) ) {
add_filter( 'body_class', 'ashram_body_classes' );
/**
* Adds custom classes to the array of body classes.
*
*/
function ashram_body_classes( $classes ) {
// Get Customizer settings
$ashram_settings = get_option( 'ashram_settings' );
$img_effect = 'enable';
$nav_effect = 'enable';
$nicescroll = 'enable';
$cursor = 'enable';
if ( isset( $ashram_settings['img_effect'] ) ) {
$img_effect = $ashram_settings['img_effect'];
}
if ( isset( $ashram_settings['nav_effect'] ) ) {
$nav_effect = $ashram_settings['nav_effect'];
}
if ( isset( $ashram_settings['nicescroll'] ) ) {
$nicescroll = $ashram_settings['nicescroll'];
}
if ( isset( $ashram_settings['cursor'] ) ) {
$cursor = $ashram_settings['cursor'];
}
// Blog image function
if ( $img_effect != 'disable' ) {
$classes[] = 'ashram-img-effect';
}
// Navigation effect
if ( $nav_effect != 'disable' ) {
$classes[] = 'ashram-nav-effect';
}
// Scrollbar style function
if ( $nicescroll != 'disable' ) {
$classes[] = 'ashram-scrollbar-style';
}
// Mouse style function
if ( $cursor != 'disable' ) {
$classes[] = 'ashram-cursor-style';
}
return $classes;
}
}
if ( ! function_exists( 'ashram_scripts' ) ) {
add_action( 'wp_enqueue_scripts', 'ashram_scripts' );
/**
* Enqueue script
*/
function ashram_scripts() {
$ashram_settings = get_option( 'ashram_settings' );
$cursor = 'enable';
if ( isset( $ashram_settings['cursor'] ) ) {
$cursor = $ashram_settings['cursor'];
}
if ( $cursor != 'disable' ) {
wp_enqueue_style( 'ashram-magic-mouse', esc_url( get_stylesheet_directory_uri() ) . "/inc/magic-mouse/magic-mouse.min.css", false, LALITA_VERSION, 'all' );
wp_enqueue_script( 'ashram-magic-mouse', esc_url( get_stylesheet_directory_uri() ) . "/inc/magic-mouse/magic-mouse.min.js", array( 'jquery'), LALITA_VERSION, true );
}
}
}