get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'bike_rental_services_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'bike_rental_services_customize_partial_blogdescription', ) ); } /* * Theme Options Panel */ $wp_customize->add_panel('bike_rental_services_panel', array( 'priority' => 25, 'capability' => 'edit_theme_options', 'title' => __('Bike Rental Services Theme Options', 'bike-rental-services'), )); /* * Customizer top header section */ $wp_customize->add_setting( 'bike_rental_services_site_title_text', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 1, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_site_title_text', array( 'label' => __('Enable Title', 'bike-rental-services'), 'description' => __('Enable or Disable Title from the site', 'bike-rental-services'), 'section' => 'title_tagline', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'bike_rental_services_site_tagline_text', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 0, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_site_tagline_text', array( 'label' => __('Enable Tagline', 'bike-rental-services'), 'description' => __('Enable or Disable Tagline from the site', 'bike-rental-services'), 'section' => 'title_tagline', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'bike_rental_services_logo_width', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '150', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_logo_width', array( 'label' => __('Logo Width in PX', 'bike-rental-services'), 'section' => 'title_tagline', 'type' => 'number', 'input_attrs' => array( 'min' => 100, 'max' => 300, 'step' => 1, ), ) ); /*Top Header Options*/ $wp_customize->add_section('bike_rental_services_topbar_section', array( 'priority' => 5, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Top Header Options', 'bike-rental-services'), 'panel' => 'bike_rental_services_panel', )); /*Phone Number Text*/ $wp_customize->add_setting( 'bike_rental_services_phone_number_text', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_phone_number_text', array( 'label' => __('Edit Phone Text', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'text', ) ); /*Phone Number*/ $wp_customize->add_setting( 'bike_rental_services_phone_number_option', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_phone_number_option', array( 'label' => __('Edit Phone Number', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'text', ) ); /*Mail Address Text*/ $wp_customize->add_setting( 'bike_rental_services_mail_address_text', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_mail_address_text', array( 'label' => __('Edit Mail Text', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'text', ) ); /*Mail Address*/ $wp_customize->add_setting( 'bike_rental_services_mail_address_option', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_mail_address_option', array( 'label' => __('Edit Mail Address ', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'text', ) ); /*Main Header Button Text*/ $wp_customize->add_setting( 'bike_rental_services_header_button_text', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_header_button_text', array( 'label' => __('Edit Button Text ', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'text', ) ); /*Main Header Button Link*/ $wp_customize->add_setting( 'bike_rental_services_header_button_link', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bike_rental_services_header_button_link', array( 'label' => __('Edit Button Link ', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'url', ) ); $wp_customize->add_setting( 'bike_rental_services_header_search', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 0, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_header_search', array( 'label' => __('Enable Disable Search', 'bike-rental-services'), 'description' => __('Enable or Disable header Search', 'bike-rental-services'), 'section' => 'bike_rental_services_topbar_section', 'type' => 'checkbox', ) ); /* * Customizer main slider section */ /*Main Slider Options*/ $wp_customize->add_section('bike_rental_services_slider_section', array( 'priority' => 5, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Main Slider Options', 'bike-rental-services'), 'panel' => 'bike_rental_services_panel', )); /*Main Slider Enable Option*/ $wp_customize->add_setting( 'bike_rental_services_enable_slider', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 0, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_enable_slider', array( 'label' => __('Enable Main Slider', 'bike-rental-services'), 'description' => __('Checked to show the main slider', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', 'type' => 'checkbox', ) ); for ($i=1; $i <= 3; $i++) { /*Main Slider Image*/ $wp_customize->add_setting( 'bike_rental_services_slider_image'.$i, array( 'capability' => 'edit_theme_options', 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bike_rental_services_slider_image'.$i, array( 'label' => __('Edit Slider Image ', 'bike-rental-services') .$i, 'description' => __('Edit the slider image.', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', ) ) ); /*Main Slider xtra Heading*/ $wp_customize->add_setting( 'bike_rental_services_slider_xtra_heading'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_slider_xtra_heading'.$i, array( 'label' => __('Edit Extra Heading Text ', 'bike-rental-services') .$i, 'description' => __('Edit the slider extra heading text.', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', 'type' => 'text', ) ); /*slider heading*/ $wp_customize->add_setting( 'bike_rental_services_slider_heading'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_slider_heading'.$i, array( 'label' => __('Edit Heading Text ', 'bike-rental-services') .$i, 'description' => __('Edit the slider heading text.', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', 'type' => 'text', ) ); /*Main Slider Content*/ $wp_customize->add_setting( 'bike_rental_services_slider_text'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_slider_text'.$i, array( 'label' => __('Edit Content Text ', 'bike-rental-services') .$i, 'description' => __('Edit the slider content text.', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', 'type' => 'text', ) ); /*Main Slider Button1 Text*/ $wp_customize->add_setting( 'bike_rental_services_slider_button1_text'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_slider_button1_text'.$i, array( 'label' => __('Edit Button #1 Text ', 'bike-rental-services') .$i, 'description' => __('Edit the slider button text.', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', 'type' => 'text', ) ); /*Main Slider Button1 URL*/ $wp_customize->add_setting( 'bike_rental_services_slider_button1_link'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bike_rental_services_slider_button1_link'.$i, array( 'label' => __('Edit Button #1 URL ', 'bike-rental-services') .$i, 'description' => __('Edit the slider button url.', 'bike-rental-services'), 'section' => 'bike_rental_services_slider_section', 'type' => 'url', ) ); } /* * Customizer feature bike section */ /*Project Options*/ $wp_customize->add_section('bike_rental_services_project_section', array( 'priority' => 5, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Featured Bike Options', 'bike-rental-services'), 'panel' => 'bike_rental_services_panel', )); /*Project Enable Option*/ $wp_customize->add_setting( 'bike_rental_services_enable_featured_bike', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 1, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_enable_featured_bike', array( 'label' => __('Enable Featured Bike Section', 'bike-rental-services'), 'description' => __('Checked to show the project', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', 'type' => 'checkbox', ) ); /*Featured Bike Short Heading*/ $wp_customize->add_setting( 'bike_rental_services_feature_short_heading', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_feature_short_heading', array( 'label' => __('Edit Section Short Heading', 'bike-rental-services'), 'description' => __('Edit feature section short heading', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', 'type' => 'text', ) ); /*Featured Bike Heading*/ $wp_customize->add_setting( 'bike_rental_services_feature_heading', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_feature_heading', array( 'label' => __('Edit Section Heading', 'bike-rental-services'), 'description' => __('Edit feature section heading', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', 'type' => 'text', ) ); $wp_customize->add_setting( 'bike_rental_services_feature_bike_box_tab_count', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 1, 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_feature_bike_box_tab_count', array( 'label' => __('Number Of Tab to Show', 'bike-rental-services'), 'description' => __('Number Of Tab to Show.', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', 'type' => 'number', 'input_attrs' => array( 'min' => 0, 'max' => 6, 'step' => 1 ) ) ); $bike_rental_services_count = get_theme_mod('bike_rental_services_feature_bike_box_tab_count') !== '' ? get_theme_mod('bike_rental_services_feature_bike_box_tab_count') : 0; for ($i=1; $i <=$bike_rental_services_count ; $i++) { /*Project Image*/ $wp_customize->add_setting( 'bike_rental_services_feature_bike_image_tab'.$i, array( 'capability' => 'edit_theme_options', 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bike_rental_services_feature_bike_image_tab'.$i, array( 'label' => __('Edit Project Image ', 'bike-rental-services') .$i, 'description' => __('Edit the project image.', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', ) ) ); /*Project Title*/ $wp_customize->add_setting( 'bike_rental_services_feature_bike_box_heading_tab'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_feature_bike_box_heading_tab'.$i, array( 'label' => __('Edit Project Title ', 'bike-rental-services') .$i, 'description' => __('Edit the project name.', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', 'type' => 'text', ) ); /*Project Text*/ $wp_customize->add_setting( 'bike_rental_services_feature_bike_box_content_tab'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_feature_bike_box_content_tab'.$i, array( 'label' => __('Edit Project Text ', 'bike-rental-services') .$i, 'description' => __('Edit the project text.', 'bike-rental-services'), 'section' => 'bike_rental_services_project_section', 'type' => 'text', ) ); /*Main Header Button Text*/ $wp_customize->add_setting( 'bike_rental_services_tab_button_text'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_tab_button_text'.$i, array( 'label' => __('Edit Button Text ', 'bike-rental-services').$i, 'section' => 'bike_rental_services_project_section', 'type' => 'text', ) ); /*Main Header Button Link*/ $wp_customize->add_setting( 'bike_rental_services_tab_button_link'.$i, array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'bike_rental_services_tab_button_link'.$i, array( 'label' => __('Edit Button Link ', 'bike-rental-services').$i, 'section' => 'bike_rental_services_project_section', 'type' => 'url', ) ); } /* * Customizer Footer Section */ /*Footer Options*/ $wp_customize->add_section('bike_rental_services_footer_section', array( 'priority' => 5, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Footer Options', 'bike-rental-services'), 'panel' => 'bike_rental_services_panel', )); /*Footer Social Menu Option*/ $wp_customize->add_setting( 'bike_rental_services_footer_social_menu', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 1, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_footer_social_menu', array( 'label' => __('Enable Footer Social Menu', 'bike-rental-services'), 'description' => __('Checked to show the footer social menu. Go to Dashboard >> Appearance >> Menus >> Create New Menu >> Add Custom Link >> Add Social Menu >> Checked Social Menu >> Save Menu.', 'bike-rental-services'), 'section' => 'bike_rental_services_footer_section', 'type' => 'checkbox', ) ); /*Go To Top Option*/ $wp_customize->add_setting( 'bike_rental_services_enable_go_to_top_option', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => 1, 'sanitize_callback' => 'bike_rental_services_sanitize_checkbox', ) ); $wp_customize->add_control( 'bike_rental_services_enable_go_to_top_option', array( 'label' => __('Enable Go To Top', 'bike-rental-services'), 'description' => __('Checked to enable Go To Top option.', 'bike-rental-services'), 'section' => 'bike_rental_services_footer_section', 'type' => 'checkbox', ) ); /*Footer Copyright Text Enable*/ $wp_customize->add_setting( 'bike_rental_services_copyright_option', array( 'capability' => 'edit_theme_options', 'transport' => 'refresh', 'default' => '', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'bike_rental_services_copyright_option', array( 'label' => __('Edit Copyright Text', 'bike-rental-services'), 'description' => __('Edit the Footer Copyright Section.', 'bike-rental-services'), 'section' => 'bike_rental_services_footer_section', 'type' => 'text', ) ); } add_action( 'customize_register', 'bike_rental_services_customize_register' ); /** * Render the site title for the selective refresh partial. * * @return void */ function bike_rental_services_customize_partial_blogname() { bloginfo( 'name' ); } /** * Render the site tagline for the selective refresh partial. * * @return void */ function bike_rental_services_customize_partial_blogdescription() { bloginfo( 'description' ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function bike_rental_services_customize_preview_js() { wp_enqueue_script( 'bike-rental-services-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), BIKE_RENTAL_SERVICES_VERSION, true ); } add_action( 'customize_preview_init', 'bike_rental_services_customize_preview_js' ); /** * Singleton class for handling the theme's customizer integration. * * @since 1.0.0 * @access public */ final class Bike_Rental_Services_Customize { /** * Returns the instance. * * @since 1.0.0 * @access public * @return object */ public static function get_instance() { static $instance = null; if ( is_null( $instance ) ) { $instance = new self; $instance->setup_actions(); } return $instance; } /** * Constructor method. * * @since 1.0.0 * @access private * @return void */ private function __construct() {} /** * Sets up initial actions. * * @since 1.0.0 * @access private * @return void */ private function setup_actions() { // Register panels, sections, settings, controls, and partials. add_action( 'customize_register', array( $this, 'sections' ) ); // Register scripts and styles for the controls. add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 ); } /** * Sets up the customizer sections. * * @since 1.0.0 * @access public * @param object $manager * @return void */ public function sections( $manager ) { // Load custom sections. load_template( trailingslashit( get_template_directory() ) . '/revolution/inc/section-pro.php' ); // Register custom section types. $manager->register_section_type( 'Bike_Rental_Services_Customize_Section_Pro' ); // Register sections. $manager->add_section( new Bike_Rental_Services_Customize_Section_Pro( $manager,'bike_rental_services_go_pro', array( 'priority' => 1, 'title' => esc_html__( 'Bike Rental Services', 'bike-rental-services' ), 'pro_text' => esc_html__( 'Buy Pro', 'bike-rental-services' ), 'pro_url' => esc_url( BIKE_RENTAL_SERVICES_BUY_NOW ), ) ) ); // Register sections. $manager->add_section( new Bike_Rental_Services_Customize_Section_Pro( $manager,'bike_rental_services_lite_documentation', array( 'priority' => 1, 'title' => esc_html__( 'Lite Documentation', 'bike-rental-services' ), 'pro_text' => esc_html__( 'Instruction', 'bike-rental-services' ), 'pro_url' => esc_url( BIKE_RENTAL_SERVICES_LITE_DOC ), ) ) ); $manager->add_section( new Bike_Rental_Services_Customize_Section_Pro( $manager, 'bike_rental_services_live_demo', array( 'priority' => 1, 'title' => esc_html__( 'Pro Theme Demo', 'bike-rental-services' ), 'pro_text' => esc_html__( 'Live Preview', 'bike-rental-services' ), 'pro_url' => esc_url( BIKE_RENTAL_SERVICES_LIVE_DEMO ), ) ) ); } /** * Loads theme customizer CSS. * * @since 1.0.0 * @access public * @return void */ public function enqueue_control_scripts() { wp_enqueue_script( 'bike-rental-services-customize-controls', trailingslashit( get_template_directory_uri() ) . '/revolution/assets/js/customize-controls.js', array( 'customize-controls' ) ); wp_enqueue_style( 'bike-rental-services-customize-controls', trailingslashit( get_template_directory_uri() ) . '/revolution/assets/css/customize-controls.css' ); } } // Doing this customizer thang! Bike_Rental_Services_Customize::get_instance();