is_rtl(), ); wp_localize_script( 'blossom-pinit', 'blossom_pinit_data', $array ); } add_action( 'wp_enqueue_scripts', 'blossom_pinit_styles', 10 ); //Remove a function from the parent theme function blossom_pinit_remove_parent_filters(){ //Have to do it after theme setup, because child theme functions are loaded first remove_action( 'customize_register', 'blossom_pin_customizer_theme_info' ); remove_action( 'customize_register', 'blossom_pin_customize_register_color' ); remove_action( 'customize_register', 'blossom_pin_customize_register_appearance' ); } add_action( 'init', 'blossom_pinit_remove_parent_filters' ); function blossom_pinit_customizer_register( $wp_customize ) { $wp_customize->add_section( 'theme_info', array( 'title' => __( 'Demo & Documentation' , 'blossom-pinit' ), 'priority' => 6, ) ); /** Important Links */ $wp_customize->add_setting( 'theme_info_theme', array( 'default' => '', 'sanitize_callback' => 'wp_kses_post', ) ); $theme_info = '
'; $theme_info .= sprintf( __( 'Demo Link: %1$sClick here.%2$s', 'blossom-pinit' ), '', '' ); $theme_info .= '
'; $theme_info .= sprintf( __( 'Documentation Link: %1$sClick here.%2$s', 'blossom-pinit' ), '', '' ); $theme_info .= '
'; $wp_customize->add_control( new Blossom_Pin_Note_Control( $wp_customize, 'theme_info_theme', array( 'section' => 'theme_info', 'description' => $theme_info ) ) ); /** Primary Color*/ $wp_customize->add_setting( 'primary_color', array( 'default' => '#ea3c53', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => __( 'Primary Color', 'blossom-pinit' ), 'description' => __( 'Primary color of the theme.', 'blossom-pinit' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Appearance Settings */ $wp_customize->add_panel( 'appearance_settings', array( 'priority' => 50, 'capability' => 'edit_theme_options', 'title' => __( 'Appearance Settings', 'blossom-pinit' ), 'description' => __( 'Customize Typography & Background Image', 'blossom-pinit' ), ) ); /** Typography */ $wp_customize->add_section( 'typography_settings', array( 'title' => __( 'Typography', 'blossom-pinit' ), 'priority' => 15, 'panel' => 'appearance_settings', ) ); /** Primary Font */ $wp_customize->add_setting( 'primary_font', array( 'default' => 'Muli', 'sanitize_callback' => 'blossom_pin_sanitize_select' ) ); $wp_customize->add_control( new Blossom_Pin_Select_Control( $wp_customize, 'primary_font', array( 'label' => __( 'Primary Font', 'blossom-pinit' ), 'description' => __( 'Primary font of the site.', 'blossom-pinit' ), 'section' => 'typography_settings', 'choices' => blossom_pin_get_all_fonts(), ) ) ); /** Secondary Font */ $wp_customize->add_setting( 'secondary_font', array( 'default' => 'EB Garamond', 'sanitize_callback' => 'blossom_pin_sanitize_select' ) ); $wp_customize->add_control( new Blossom_Pin_Select_Control( $wp_customize, 'secondary_font', array( 'label' => __( 'Secondary Font', 'blossom-pinit' ), 'description' => __( 'Secondary font of the site.', 'blossom-pinit' ), 'section' => 'typography_settings', 'choices' => blossom_pin_get_all_fonts(), ) ) ); /** Font Size*/ $wp_customize->add_setting( 'font_size', array( 'default' => 18, 'sanitize_callback' => 'blossom_pin_sanitize_number_absint' ) ); $wp_customize->add_control( new Blossom_Pin_Slider_Control( $wp_customize, 'font_size', array( 'section' => 'typography_settings', 'label' => __( 'Font Size', 'blossom-pinit' ), 'description' => __( 'Change the font size of your site.', 'blossom-pinit' ), 'choices' => array( 'min' => 10, 'max' => 50, 'step' => 1, ) ) ) ); /** Move Background Image section to appearance panel */ $wp_customize->get_section( 'background_image' )->panel = 'appearance_settings'; $wp_customize->get_section( 'background_image' )->priority = 10; /** Blog Layout */ $wp_customize->add_section( 'header_layout', array( 'title' => __( 'Header Layout', 'blossom-pinit' ), 'panel' => 'layout_settings', 'priority' => 10, ) ); /** Blog Page layout */ $wp_customize->add_setting( 'header_layout_option', array( 'default' => 'two', 'sanitize_callback' => 'blossom_pin_sanitize_radio' ) ); $wp_customize->add_control( new Blossom_Pin_Radio_Image_Control( $wp_customize, 'header_layout_option', array( 'section' => 'header_layout', 'label' => __( 'Header Layout', 'blossom-pinit' ), 'description' => __( 'it is the layout for header.', 'blossom-pinit' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/header/one.jpg', 'two' => get_stylesheet_directory_uri() . '/images/header/two.jpg', ) ) ) ); /** Slider Layout Settings */ $wp_customize->add_section( 'slider_layout_settings', array( 'title' => __( 'Slider Layout', 'blossom-pinit' ), 'priority' => 20, 'panel' => 'layout_settings', ) ); /** Page Sidebar layout */ $wp_customize->add_setting( 'slider_layout', array( 'default' => 'two', 'sanitize_callback' => 'blossom_pin_sanitize_radio' ) ); $wp_customize->add_control( new Blossom_Pin_Radio_Image_Control( $wp_customize, 'slider_layout', array( 'section' => 'slider_layout_settings', 'label' => __( 'Slider Layout', 'blossom-pinit' ), 'description' => __( 'Choose the layout of the slider for your site.', 'blossom-pinit' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/slider/one.jpg', 'two' => get_stylesheet_directory_uri() . '/images/slider/two.jpg', ) ) ) ); } add_action( 'customize_register', 'blossom_pinit_customizer_register', 40 ); function blossom_pin_header(){ $header_layout = get_theme_mod( 'header_layout_option', 'two' ); ?>