register_section_type( Bicycle_Repair_Button::class ); $manager->add_section( new Bicycle_Repair_Button( $manager, 'bicycle_repair_pro', [ 'title' => __( 'Bicycle Repair Pro', 'bicycle-repair' ), 'priority' => 0, 'button_text' => __( 'Go Pro', 'bicycle-repair' ), 'button_url' => esc_url( 'https://www.luzuk.com/product/bicycle-repair-wordpress-theme/', 'bicycle-repair') ] ) ); } ); // Load the JS and CSS. add_action( 'customize_controls_enqueue_scripts', function() { $version = wp_get_theme()->get( 'Version' ); wp_enqueue_script( 'bicycle-repair-customize-section-button', get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/js/customize-controls.js' ), [ 'customize-controls' ], $version, true ); wp_enqueue_style( 'bicycle-repair-customize-section-button', get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/css/customize-controls.css' ), [ 'customize-controls' ], $version ); } ); function bicycle_repair_customize_register( $wp_customize ) { $wp_customize->add_setting('bicycle_repair_logo_padding',array( 'sanitize_callback' => 'esc_html' )); $wp_customize->add_control('bicycle_repair_logo_padding',array( 'label' => __('Logo Margin','bicycle-repair'), 'section' => 'title_tagline' )); $wp_customize->add_setting('bicycle_repair_logo_top_padding',array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_float' )); $wp_customize->add_control('bicycle_repair_logo_top_padding',array( 'type' => 'number', 'description' => __('Top','bicycle-repair'), 'section' => 'title_tagline', )); $wp_customize->add_setting('bicycle_repair_logo_bottom_padding',array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_float' )); $wp_customize->add_control('bicycle_repair_logo_bottom_padding',array( 'type' => 'number', 'description' => __('Bottom','bicycle-repair'), 'section' => 'title_tagline', )); $wp_customize->add_setting('bicycle_repair_logo_left_padding',array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_float' )); $wp_customize->add_control('bicycle_repair_logo_left_padding',array( 'type' => 'number', 'description' => __('Left','bicycle-repair'), 'section' => 'title_tagline', )); $wp_customize->add_setting('bicycle_repair_logo_right_padding',array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_float' )); $wp_customize->add_control('bicycle_repair_logo_right_padding',array( 'type' => 'number', 'description' => __('Right','bicycle-repair'), 'section' => 'title_tagline', )); $wp_customize->add_setting('bicycle_repair_show_site_title',array( 'default' => true, 'sanitize_callback' => 'bicycle_repair_sanitize_checkbox' )); $wp_customize->add_control('bicycle_repair_show_site_title',array( 'type' => 'checkbox', 'label' => __('Show / Hide Site Title','bicycle-repair'), 'section' => 'title_tagline' )); $wp_customize->add_setting('bicycle_repair_site_title_font_size',array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_float' )); $wp_customize->add_control('bicycle_repair_site_title_font_size',array( 'type' => 'number', 'label' => __('Site Title Font Size','bicycle-repair'), 'section' => 'title_tagline', )); $wp_customize->add_setting('bicycle_repair_show_tagline',array( 'default' => true, 'sanitize_callback' => 'bicycle_repair_sanitize_checkbox' )); $wp_customize->add_control('bicycle_repair_show_tagline',array( 'type' => 'checkbox', 'label' => __('Show / Hide Site Tagline','bicycle-repair'), 'section' => 'title_tagline' )); $wp_customize->add_setting('bicycle_repair_site_tagline_font_size',array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_float' )); $wp_customize->add_control('bicycle_repair_site_tagline_font_size',array( 'type' => 'number', 'label' => __('Site Tagline Font Size','bicycle-repair'), 'section' => 'title_tagline', )); $wp_customize->add_panel( 'bicycle_repair_panel_id', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Theme Settings', 'bicycle-repair' ), 'description' => __( 'Description of what this panel does.', 'bicycle-repair' ), ) ); $wp_customize->add_section( 'bicycle_repair_theme_options_section', array( 'title' => __( 'General Settings', 'bicycle-repair' ), 'priority' => 30, 'panel' => 'bicycle_repair_panel_id' ) ); $wp_customize->add_setting('bicycle_repair_theme_options',array( 'default' => 'Right Sidebar', 'sanitize_callback' => 'bicycle_repair_sanitize_choices' )); $wp_customize->add_control('bicycle_repair_theme_options',array( 'type' => 'select', 'label' => __('Blog Page Sidebar Layout','bicycle-repair'), 'section' => 'bicycle_repair_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','bicycle-repair'), 'Right Sidebar' => __('Right Sidebar','bicycle-repair'), 'One Column' => __('One Column','bicycle-repair'), 'Grid Layout' => __('Grid Layout','bicycle-repair') ), )); $wp_customize->add_setting('bicycle_repair_single_post_sidebar',array( 'default' => 'Right Sidebar', 'sanitize_callback' => 'bicycle_repair_sanitize_choices' )); $wp_customize->add_control('bicycle_repair_single_post_sidebar',array( 'type' => 'select', 'label' => __('Single Post Sidebar Layout','bicycle-repair'), 'section' => 'bicycle_repair_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','bicycle-repair'), 'Right Sidebar' => __('Right Sidebar','bicycle-repair'), 'One Column' => __('One Column','bicycle-repair') ), )); $wp_customize->add_setting('bicycle_repair_page_sidebar',array( 'default' => 'One Column', 'sanitize_callback' => 'bicycle_repair_sanitize_choices' )); $wp_customize->add_control('bicycle_repair_page_sidebar',array( 'type' => 'select', 'label' => __('Page Sidebar Layout','bicycle-repair'), 'section' => 'bicycle_repair_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','bicycle-repair'), 'Right Sidebar' => __('Right Sidebar','bicycle-repair'), 'One Column' => __('One Column','bicycle-repair') ), )); $wp_customize->add_setting('bicycle_repair_archive_page_sidebar',array( 'default' => 'Right Sidebar', 'sanitize_callback' => 'bicycle_repair_sanitize_choices' )); $wp_customize->add_control('bicycle_repair_archive_page_sidebar',array( 'type' => 'select', 'label' => __('Archive & Search Page Sidebar Layout','bicycle-repair'), 'section' => 'bicycle_repair_theme_options_section', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','bicycle-repair'), 'Right Sidebar' => __('Right Sidebar','bicycle-repair'), 'One Column' => __('One Column','bicycle-repair'), 'Grid Layout' => __('Grid Layout','bicycle-repair') ), )); //Header $wp_customize->add_section( 'bicycle_repair_social_icons' , array( 'title' => __( 'Social Icons', 'bicycle-repair' ), 'priority' => null, 'panel' => 'bicycle_repair_panel_id' ) ); $wp_customize->add_setting('bicycle_repair_facebook_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('bicycle_repair_facebook_url',array( 'type' => 'url', 'label' => __('Add Facebook URL','bicycle-repair'), 'section' => 'bicycle_repair_social_icons', )); $wp_customize->add_setting('bicycle_repair_twitter_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('bicycle_repair_twitter_url',array( 'type' => 'url', 'label' => __('Add Twitter URL','bicycle-repair'), 'section' => 'bicycle_repair_social_icons', )); $wp_customize->add_setting('bicycle_repair_instagram_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('bicycle_repair_instagram_url',array( 'type' => 'url', 'label' => __('Add Instagram URL','bicycle-repair'), 'section' => 'bicycle_repair_social_icons', )); $wp_customize->add_setting('bicycle_repair_whatsapp_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('bicycle_repair_whatsapp_url',array( 'type' => 'url', 'label' => __('Add Whatsapp URL','bicycle-repair'), 'section' => 'bicycle_repair_social_icons', )); //home page slider $wp_customize->add_section( 'bicycle_repair_slider_section' , array( 'title' => __( 'Slider Settings', 'bicycle-repair' ), 'priority' => null, 'panel' => 'bicycle_repair_panel_id' ) ); $wp_customize->add_setting('bicycle_repair_slider_hide_show',array( 'default' => false, 'sanitize_callback' => 'bicycle_repair_sanitize_checkbox' )); $wp_customize->add_control('bicycle_repair_slider_hide_show',array( 'type' => 'checkbox', 'label' => __('Show / Hide Slider','bicycle-repair'), 'section' => 'bicycle_repair_slider_section', )); for ( $count = 1; $count <= 4; $count++ ) { $wp_customize->add_setting( 'bicycle_repair_slider' . $count, array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_dropdown_pages' )); $wp_customize->add_control( 'bicycle_repair_slider' . $count, array( 'label' => __('Select Slider Image Page', 'bicycle-repair' ), 'description'=> __('Image size (350px x 350px)','bicycle-repair'), 'section' => 'bicycle_repair_slider_section', 'type' => 'dropdown-pages' )); } $wp_customize->add_setting( 'bicycle_repair_slider_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'bicycle_repair_slider_color', array( 'label' => 'Text Color', 'section' => 'bicycle_repair_slider_section', ))); //About Section $wp_customize->add_section('bicycle_repair_about_section',array( 'title' => __('About Section','bicycle-repair'), 'description'=> __('This section will appear below the slider.','bicycle-repair'), 'panel' => 'bicycle_repair_panel_id', )); $wp_customize->add_setting('bicycle_repair_section_title',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('bicycle_repair_section_title',array( 'label' => __('Section Title','bicycle-repair'), 'section' => 'bicycle_repair_about_section', 'type' => 'text' )); $wp_customize->add_setting( 'bicycle_repair_about_page', array( 'default' => '', 'sanitize_callback' => 'bicycle_repair_sanitize_dropdown_pages' )); $wp_customize->add_control( 'bicycle_repair_about_page', array( 'label' => __('Select Slider Image Page', 'bicycle-repair' ), 'description' => __('Image size (600px x 300px)','bicycle-repair'), 'section' => 'bicycle_repair_about_section', 'type' => 'dropdown-pages' )); $wp_customize->add_setting( 'bicycle_repair_about_color', array( 'default' => '', 'sanitize_callback' => 'sanitize_hex_color' )); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'bicycle_repair_about_color', array( 'label' => 'Text Color', 'section' => 'bicycle_repair_about_section', ))); //Footer $wp_customize->add_section( 'bicycle_repair_footer', array( 'title' => __( 'Footer Text', 'bicycle-repair' ), 'priority' => null, 'panel' => 'bicycle_repair_panel_id' ) ); $wp_customize->add_setting('bicycle_repair_show_back_totop',array( 'default' => true, 'sanitize_callback' => 'bicycle_repair_sanitize_checkbox' )); $wp_customize->add_control('bicycle_repair_show_back_totop',array( 'type' => 'checkbox', 'label' => __('Show / Hide Back to Top','bicycle-repair'), 'section' => 'bicycle_repair_footer' )); $wp_customize->add_setting('bicycle_repair_footer_copy',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('bicycle_repair_footer_copy',array( 'label' => __('Footer Text','bicycle-repair'), 'section' => 'bicycle_repair_footer', 'setting' => 'bicycle_repair_footer_copy', 'type' => 'text' )); $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'bicycle_repair_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'bicycle_repair_customize_partial_blogdescription', ) ); } add_action( 'customize_register', 'bicycle_repair_customize_register' ); function bicycle_repair_customize_partial_blogname() { bloginfo( 'name' ); } function bicycle_repair_customize_partial_blogdescription() { bloginfo( 'description' ); }