is_rtl(), 'loop' => (bool) get_theme_mod( 'slider_loop', true ), 'auto' => get_theme_mod( 'slider_auto', true ), ); wp_localize_script( 'cook-recipe', 'cook_recipe_data', $array ); } add_action( 'wp_enqueue_scripts', 'cook_recipe_styles', 10 ); //Remove a function from the parent theme function cook_recipe_remove_parent_filters(){ remove_action( 'customize_register', 'cookery_lite_customizer_theme_info' ); remove_action( 'customize_register', 'cookery_lite_customize_register_appearance' ); remove_action( 'wp_head', 'cookery_lite_dynamic_css', 99 ); } add_action( 'init', 'cook_recipe_remove_parent_filters' ); function cook_recipe_customizer_register( $wp_customize ) { $wp_customize->add_section( 'theme_info', array( 'title' => __( 'Information Links', 'cook-recipe' ), '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', 'cook-recipe' ), '', '' ); $theme_info .= '
'; $theme_info .= sprintf( __( 'Documentation Link: %1$sClick here.%2$s', 'cook-recipe' ), '', '' ); $theme_info .= '
'; $wp_customize->add_control( new Cookery_Lite_Note_Control( $wp_customize, 'theme_info_theme', array( 'section' => 'theme_info', 'description' => $theme_info ) ) ); /** Header Layout Settings */ $wp_customize->add_section( 'header_layout_settings', array( 'title' => __( 'Header Layout', 'cook-recipe' ), 'priority' => 10, 'panel' => 'layout_settings', ) ); /** Page Sidebar layout */ $wp_customize->add_setting( 'header_layout', array( 'default' => 'two', 'sanitize_callback' => 'cookery_lite_sanitize_radio' ) ); $wp_customize->add_control( new Cookery_Lite_Radio_Image_Control( $wp_customize, 'header_layout', array( 'section' => 'header_layout_settings', 'label' => __( 'Header Layout', 'cook-recipe' ), 'description' => __( 'Choose the layout of the header for your site.', 'cook-recipe' ), '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', 'cook-recipe' ), 'priority' => 20, 'panel' => 'layout_settings', ) ); /** Page Sidebar layout */ $wp_customize->add_setting( 'slider_layout', array( 'default' => 'four', 'sanitize_callback' => 'cookery_lite_sanitize_radio' ) ); $wp_customize->add_control( new Cookery_Lite_Radio_Image_Control( $wp_customize, 'slider_layout', array( 'section' => 'slider_layout_settings', 'label' => __( 'Slider Layout', 'cook-recipe' ), 'description' => __( 'Choose the layout of the slider for your site.', 'cook-recipe' ), 'choices' => array( 'one' => get_stylesheet_directory_uri() . '/images/slider/one.jpg', 'four' => get_stylesheet_directory_uri() . '/images/slider/four.jpg', ) ) ) ); $wp_customize->add_panel( 'appearance_settings', array( 'title' => __( 'Appearance Settings', 'cook-recipe' ), 'priority' => 25, 'capability' => 'edit_theme_options', 'description' => __( 'Change color and body background.', 'cook-recipe' ), ) ); /** Typography */ $wp_customize->add_section( 'typography_settings', array( 'title' => __( 'Typography', 'cook-recipe' ), 'priority' => 20, 'panel' => 'appearance_settings', ) ); /** Primary Font */ $wp_customize->add_setting( 'primary_font', array( 'default' => 'Bitter', 'sanitize_callback' => 'cookery_lite_sanitize_select' ) ); $wp_customize->add_control( new Cookery_Lite_Select_Control( $wp_customize, 'primary_font', array( 'label' => __( 'Primary Font', 'cook-recipe' ), 'description' => __( 'Primary font of the site.', 'cook-recipe' ), 'section' => 'typography_settings', 'choices' => cookery_lite_get_all_fonts(), ) ) ); /** Secondary Font */ $wp_customize->add_setting( 'secondary_font', array( 'default' => 'Domine', 'sanitize_callback' => 'cookery_lite_sanitize_select' ) ); $wp_customize->add_control( new Cookery_Lite_Select_Control( $wp_customize, 'secondary_font', array( 'label' => __( 'Secondary Font', 'cook-recipe' ), 'description' => __( 'Secondary font of the site.', 'cook-recipe' ), 'section' => 'typography_settings', 'choices' => cookery_lite_get_all_fonts(), ) ) ); /** Font Size*/ $wp_customize->add_setting( 'font_size', array( 'default' => 18, 'sanitize_callback' => 'cookery_lite_sanitize_number_absint' ) ); $wp_customize->add_control( new Cookery_Lite_Slider_Control( $wp_customize, 'font_size', array( 'section' => 'typography_settings', 'label' => __( 'Font Size', 'cook-recipe' ), 'description' => __( 'Change the font size of your site.', 'cook-recipe' ), 'choices' => array( 'min' => 10, 'max' => 50, 'step' => 1, ) ) ) ); $wp_customize->add_setting( 'ed_localgoogle_fonts', array( 'default' => false, 'sanitize_callback' => 'cookery_lite_sanitize_checkbox', ) ); $wp_customize->add_control( new Cookery_Lite_Toggle_Control( $wp_customize, 'ed_localgoogle_fonts', array( 'section' => 'typography_settings', 'label' => __( 'Load Google Fonts Locally', 'cook-recipe' ), 'description' => __( 'Enable to load google fonts from your own server instead from google\'s CDN. This solves privacy concerns with Google\'s CDN and their sometimes less-than-transparent policies.', 'cook-recipe' ) ) ) ); $wp_customize->add_setting( 'ed_preload_local_fonts', array( 'default' => false, 'sanitize_callback' => 'cookery_lite_sanitize_checkbox', ) ); $wp_customize->add_control( new Cookery_Lite_Toggle_Control( $wp_customize, 'ed_preload_local_fonts', array( 'section' => 'typography_settings', 'label' => __( 'Preload Local Fonts', 'cook-recipe' ), 'description' => __( 'Preloading Google fonts will speed up your website speed.', 'cook-recipe' ), 'active_callback' => 'cookery_lite_ed_localgoogle_fonts' ) ) ); ob_start(); ?> add_setting( 'ed_flush_local_fonts', array( 'sanitize_callback' => 'wp_kses_post', ) ); $wp_customize->add_control( 'ed_flush_local_fonts', array( 'label' => __( 'Flush Local Fonts Cache', 'cook-recipe' ), 'section' => 'typography_settings', 'description' => $cook_recipe_flush_button, 'type' => 'hidden', 'active_callback' => 'cookery_lite_ed_localgoogle_fonts' ) ); /** Primary Color*/ $wp_customize->add_setting( 'primary_color', array( 'default' => '#f15641', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'primary_color', array( 'label' => __( 'Primary Color', 'cook-recipe' ), 'description' => __( 'Primary color of the theme.', 'cook-recipe' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Secondary Color*/ $wp_customize->add_setting( 'secondary_color', array( 'default' => '#f1ae41', 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'secondary_color', array( 'label' => __( 'Secondary Color', 'cook-recipe' ), 'description' => __( 'Secondary color of the theme.', 'cook-recipe' ), 'section' => 'colors', 'priority' => 5, ) ) ); /** Move Background Image section to appearance panel */ $wp_customize->get_section( 'colors' )->panel = 'appearance_settings'; $wp_customize->get_section( 'colors' )->priority = 10; $wp_customize->get_section( 'background_image' )->panel = 'appearance_settings'; $wp_customize->get_section( 'background_image' )->priority = 15; } add_action( 'customize_register', 'cook_recipe_customizer_register', 40 ); /** * Header Start */ function cookery_lite_header(){ $ed_cart = get_theme_mod( 'ed_shopping_cart', true ); $ed_search = get_theme_mod( 'ed_header_search', true ); $header_layout = get_theme_mod( 'header_layout', 'two' ); ?>