'000000', 'default-image' => '', 'default-repeat' => 'repeat', 'default-position-x' => 'center', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-attachment' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ) ); } function martanda_font_family_css() { // Get our settings $martanda_settings = wp_parse_args( get_option( 'martanda_settings', array() ), martanda_get_defaults() ); // Initiate our class $css = new martanda_css; $og_defaults = martanda_get_defaults( false ); $bodyclass = 'body'; if ( is_admin() ) { $bodyclass = '.editor-styles-wrapper'; } $bodyfont = $martanda_settings[ 'font_body' ]; if ( $bodyfont == 'inherit' ) { $bodyfont = 'Inter'; } $font_site_title = $martanda_settings[ 'font_site_title' ]; if ( $font_site_title == 'inherit' ) { $font_site_title = 'Inter'; } $font_navigation = $martanda_settings[ 'font_navigation' ]; if ( $font_navigation == 'inherit' ) { $font_navigation = 'Inter'; } $font_buttons = $martanda_settings[ 'font_buttons' ]; if ( $font_buttons == 'inherit' ) { $font_buttons = 'Inter'; } $font_heading_1 = $martanda_settings[ 'font_heading_1' ]; if ( $font_heading_1 == 'inherit' ) { $font_heading_1 = 'Inter'; } $font_heading_2 = $martanda_settings[ 'font_heading_2' ]; if ( $font_heading_2 == 'inherit' ) { $font_heading_2 = 'Inter'; } $font_heading_3 = $martanda_settings[ 'font_heading_3' ]; if ( $font_heading_3 == 'inherit' ) { $font_heading_3 = 'Inter'; } $font_heading_4 = $martanda_settings[ 'font_heading_4' ]; if ( $font_heading_4 == 'inherit' ) { $font_heading_4 = 'Inter'; } $font_heading_5 = $martanda_settings[ 'font_heading_5' ]; if ( $font_heading_5 == 'inherit' ) { $font_heading_5 = 'Inter'; } $font_heading_6 = $martanda_settings[ 'font_heading_6' ]; if ( $font_heading_6 == 'inherit' ) { $font_heading_6 = 'Inter'; } $font_footer = $martanda_settings[ 'font_footer' ]; if ( $font_footer == 'inherit' ) { $font_footer = 'Inter'; } $font_fixed_side = $martanda_settings[ 'font_fixed_side' ]; if ( $font_fixed_side == 'inherit' ) { $font_fixed_side = 'Inter'; } $css->set_selector( $bodyclass ); $css->add_property( '--martanda--font-body', esc_attr( $bodyfont ) ); $css->add_property( '--martanda--font-site-title', esc_attr( $font_site_title ) ); $css->add_property( '--martanda--font-navigation', esc_attr( $font_navigation ) ); $css->add_property( '--martanda--font-buttons', esc_attr( $font_buttons ) ); $css->add_property( '--martanda--font-heading-1', esc_attr( $font_heading_1 ) ); $css->add_property( '--martanda--font-heading-2', esc_attr( $font_heading_2 ) ); $css->add_property( '--martanda--font-heading-3', esc_attr( $font_heading_3 ) ); $css->add_property( '--martanda--font-heading-4', esc_attr( $font_heading_4 ) ); $css->add_property( '--martanda--font-heading-5', esc_attr( $font_heading_5 ) ); $css->add_property( '--martanda--font-heading-6', esc_attr( $font_heading_6 ) ); $css->add_property( '--martanda--font-footer', esc_attr( $font_footer ) ); $css->add_property( '--martanda--font-fixed-side', esc_attr( $font_fixed_side ) ); $css->set_selector( '.editor-styles-wrapper .top-bar-socials button' ); $css->add_property( 'background-color', 'inherit' ); // Allow us to hook CSS into our output do_action( 'martanda_font_family_css', $css ); return apply_filters( 'martanda_font_family_css_output', $css->css_output() ); } // Overwrite theme URL function martanda_theme_uri_link() { return 'https://wpkoi.com/abhokta-wpkoi-wordpress-theme/'; } // Extra cutomizer functions if ( ! function_exists( 'abhokta_customize_register' ) ) { add_action( 'customize_register', 'abhokta_customize_register' ); function abhokta_customize_register( $wp_customize ) { // Add Abhokta customizer section $wp_customize->add_section( 'abhokta_layout_effects', array( 'title' => __( 'Abhokta borders', 'abhokta' ), 'priority' => 24, ) ); // Navigation effect $wp_customize->add_setting( 'abhokta_settings[nav_effect]', array( 'default' => 'enable', 'type' => 'option', 'sanitize_callback' => 'abhokta_sanitize_choices' ) ); $wp_customize->add_control( 'abhokta_settings[nav_effect]', array( 'type' => 'select', 'label' => __( 'Navigation effect', 'abhokta' ), 'choices' => array( 'enable' => __( 'Enable', 'abhokta' ), 'disable' => __( 'Disable', 'abhokta' ) ), 'settings' => 'abhokta_settings[nav_effect]', 'section' => 'abhokta_layout_effects', 'priority' => 30 ) ); // Page border $wp_customize->add_setting( 'abhokta_settings[page_border]', array( 'default' => 'enable', 'type' => 'option', 'sanitize_callback' => 'abhokta_sanitize_choices' ) ); $wp_customize->add_control( 'abhokta_settings[page_border]', array( 'type' => 'select', 'label' => __( 'Side border for pages', 'abhokta' ), 'choices' => array( 'enable' => __( 'Enable', 'abhokta' ), 'disable' => __( 'Disable', 'abhokta' ) ), 'settings' => 'abhokta_settings[page_border]', 'section' => 'abhokta_layout_effects', 'priority' => 30 ) ); // Effect colors $wp_customize->add_setting( 'abhokta_settings[abhokta_color_1]', array( 'default' => '#000000', 'type' => 'option', 'sanitize_callback' => 'abhokta_sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'abhokta_settings[abhokta_color_1]', array( 'label' => __( 'Border color', 'abhokta' ), 'section' => 'abhokta_layout_effects', 'settings' => 'abhokta_settings[abhokta_color_1]', 'priority' => 35 ) ) ); } } //Sanitize choices. if ( ! function_exists( 'abhokta_sanitize_choices' ) ) { function abhokta_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 ); } } // Sanitize colors. Allow blank value. if ( ! function_exists( 'abhokta_sanitize_hex_color' ) ) { function abhokta_sanitize_hex_color( $color ) { if ( '' === $color ) { return ''; } // 3 or 6 hex digits, or the empty string. if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { return $color; } return ''; } } // Abhokta effects css if ( ! function_exists( 'abhokta_effect_css' ) ) { function abhokta_effect_css() { // Get Customizer settings $abhokta_settings = get_option( 'abhokta_settings' ); $abhokta_color_1 = isset( $abhokta_settings['abhokta_color_1'] ) ? $abhokta_settings['abhokta_color_1'] : '#000000'; $abhokta_effect_css = 'body {--martanda--abhokta-color-1: ' . esc_attr( $abhokta_color_1 ) . ';}'; return $abhokta_effect_css; } } // The dynamic styles of the parent theme added inline to the parent stylesheet. // For the customizer functions it is better to enqueue after the child theme stylesheet. if ( ! function_exists( 'abhokta_remove_parent_dynamic_css' ) ) { add_action( 'init', 'abhokta_remove_parent_dynamic_css' ); function abhokta_remove_parent_dynamic_css() { remove_action( 'wp_enqueue_scripts', 'martanda_enqueue_dynamic_css', 50 ); } } // Enqueue this CSS after the child stylesheet, not after the parent stylesheet. if ( ! function_exists( 'abhokta_enqueue_parent_dynamic_css' ) ) { add_action( 'wp_enqueue_scripts', 'abhokta_enqueue_parent_dynamic_css', 50 ); function abhokta_enqueue_parent_dynamic_css() { $css = martanda_get_font_face_styles() . martanda_font_family_css() . martanda_base_css() . abhokta_effect_css(); // escaped secure before in parent theme wp_add_inline_style( 'martanda-child', $css ); } } //Adds custom classes to the array of body classes. if ( ! function_exists( 'abhokta_body_classes' ) ) { add_filter( 'body_class', 'abhokta_body_classes' ); function abhokta_body_classes( $classes ) { // Get Customizer settings $abhokta_settings = get_option( 'abhokta_settings' ); $nav_effect = 'enable'; if ( isset( $abhokta_settings['nav_effect'] ) ) { $nav_effect = $abhokta_settings['nav_effect']; } $page_border = 'enable'; if ( isset( $abhokta_settings['page_border'] ) ) { $page_border = $abhokta_settings['page_border']; } // Navigation effect if ( $nav_effect != 'disable' ) { $classes[] = 'abhokta-nav-effect'; } // Page border if ( $page_border != 'disable' ) { $classes[] = 'abhokta-page-border'; } return $classes; } }