default ); } $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; wp_enqueue_style('apartment-rental-services-customize-controls', trailingslashit(esc_url(get_template_directory_uri())).'/css/customize-controls.css'); //Logo $wp_customize->add_setting('apartment_rental_services_logo_width', array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'apartment_rental_services_sanitize_integer' )); $wp_customize->add_control(new Apartment_Rental_Services_Slider_Custom_Control($wp_customize, 'apartment_rental_services_logo_width', array( 'label' => __( 'Logo Width', 'apartment-rental-services'), 'section' => 'title_tagline', 'settings' => 'apartment_rental_services_logo_width', 'input_attrs' => array( 'step' => 1, 'min' => 0, 'max' => 100, ), ))); // color site title $wp_customize->add_setting('apartment_rental_services_sitetitle_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_sitetitle_color', array( 'settings' => 'apartment_rental_services_sitetitle_color', 'section' => 'title_tagline', 'label' => __('Site Title Color', 'apartment-rental-services'), 'type' => 'color' )); $wp_customize->add_setting('apartment_rental_services_title_enable',array( 'default' => true, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', )); $wp_customize->add_control( 'apartment_rental_services_title_enable', array( 'settings' => 'apartment_rental_services_title_enable', 'section' => 'title_tagline', 'label' => __('Enable Site Title','apartment-rental-services'), 'type' => 'checkbox' )); // color site tagline $wp_customize->add_setting('apartment_rental_services_sitetagline_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_sitetagline_color', array( 'settings' => 'apartment_rental_services_sitetagline_color', 'section' => 'title_tagline', 'label' => __('Site Tagline Color', 'apartment-rental-services'), 'type' => 'color' )); $wp_customize->add_setting('apartment_rental_services_tagline_enable',array( 'default' => false, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', )); $wp_customize->add_control( 'apartment_rental_services_tagline_enable', array( 'settings' => 'apartment_rental_services_tagline_enable', 'section' => 'title_tagline', 'label' => __('Enable Site Tagline','apartment-rental-services'), 'type' => 'checkbox' )); //Theme Options $wp_customize->add_panel( 'apartment_rental_services_panel_area', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'title' => __( 'Theme Options Panel', 'apartment-rental-services' ), ) ); //Site Layout Section $wp_customize->add_section('apartment_rental_services_site_layoutsec',array( 'title' => __('Manage Site Layout Section ','apartment-rental-services'), 'description' => __('

Manage Site Layout Section

','apartment-rental-services'), 'priority' => 1, 'panel' => 'apartment_rental_services_panel_area', )); $wp_customize->add_setting('apartment_rental_services_box_layout',array( 'default' => false, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', )); $wp_customize->add_control( 'apartment_rental_services_box_layout', array( 'section' => 'apartment_rental_services_site_layoutsec', 'label' => __('Check to Show Box Layout','apartment-rental-services'), 'type' => 'checkbox' )); $wp_customize->add_setting('apartment_rental_services_preloader',array( 'default' => true, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', )); $wp_customize->add_control( 'apartment_rental_services_preloader', array( 'section' => 'apartment_rental_services_site_layoutsec', 'label' => __('Check to Show preloader','apartment-rental-services'), 'type' => 'checkbox' )); // Header Section $wp_customize->add_section('apartment_rental_services_header_section', array( 'title' => __('Manage Header Section', 'apartment-rental-services'), 'description' => __('

Manage Header Section

','apartment-rental-services'), 'priority' => null, 'panel' => 'apartment_rental_services_panel_area', )); $wp_customize->add_setting('apartment_rental_services_header_btn_text',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_header_btn_text', array( 'settings' => 'apartment_rental_services_header_btn_text', 'section' => 'apartment_rental_services_header_section', 'label' => __('Add Button Text', 'apartment-rental-services'), 'type' => 'text' )); $wp_customize->add_setting('apartment_rental_services_header_btn_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_header_btn_url', array( 'settings' => 'apartment_rental_services_header_btn_url', 'section' => 'apartment_rental_services_header_section', 'label' => __('Add Button URL', 'apartment-rental-services'), 'type' => 'url' )); // header menu $wp_customize->add_setting('apartment_rental_services_menu_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_menu_color', array( 'settings' => 'apartment_rental_services_menu_color', 'section' => 'apartment_rental_services_header_section', 'label' => __('Menu Color', 'apartment-rental-services'), 'type' => 'color' )); // header menu hover color $wp_customize->add_setting('apartment_rental_services_menuhrv_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_menuhrv_color', array( 'settings' => 'apartment_rental_services_menuhrv_color', 'section' => 'apartment_rental_services_header_section', 'label' => __('Menu Hover Color', 'apartment-rental-services'), 'type' => 'color' )); // header sub menu color $wp_customize->add_setting('apartment_rental_services_submenu_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_submenu_color', array( 'settings' => 'apartment_rental_services_submenu_color', 'section' => 'apartment_rental_services_header_section', 'label' => __('SubMenu Color', 'apartment-rental-services'), 'type' => 'color' )); // header sub menu hover color $wp_customize->add_setting('apartment_rental_services_submenuhrv_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_submenuhrv_color', array( 'settings' => 'apartment_rental_services_submenuhrv_color', 'section' => 'apartment_rental_services_header_section', 'label' => __('SubMenu Hover Color', 'apartment-rental-services'), 'type' => 'color' )); // Slider Section $wp_customize->add_section('apartment_rental_services_slider_section',array( 'title' => __('Manage Slider Section','apartment-rental-services'), 'priority' => null, 'description' => __('

Manage Slider Section

Select Category from the Dropdowns for slider, Also use the given image dimension (1200 x 740).','apartment-rental-services'), 'panel' => 'apartment_rental_services_panel_area', )); $wp_customize->add_setting('apartment_rental_services_slider',array( 'default' => false, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_slider', array( 'settings' => 'apartment_rental_services_slider', 'section' => 'apartment_rental_services_slider_section', 'label' => __('Check To Enable This Section','apartment-rental-services'), 'type' => 'checkbox' )); $categories = get_categories(); $cat_post = array(); $cat_post['0'] = 'Select'; foreach ($categories as $category) { $cat_post[$category->slug] = $category->name; } $wp_customize->add_setting('apartment_rental_services_slider_cat', array( 'default' => '0', 'sanitize_callback' => 'apartment_rental_services_sanitize_choices', )); $wp_customize->add_control('apartment_rental_services_slider_cat', array( 'type' => 'select', 'choices' => $cat_post, 'label' => __('Select Category to display Latest Post', 'apartment-rental-services'), 'description' => __('

Choose a category, then reload the page.

', 'apartment-rental-services'), 'section' => 'apartment_rental_services_slider_section', )); $selected_category = get_theme_mod('apartment_rental_services_slider_cat', '0'); if ($selected_category && $selected_category !== '0') { $posts = get_posts(array( 'category_name' => $selected_category, 'posts_per_page' => -1, )); foreach ($posts as $post) { for ($apartment_rental_services_i = 1; $apartment_rental_services_i <= 3; $apartment_rental_services_i++) { $setting_id = 'apartment_rental_services_slider_img' . $post->ID . '_' . $apartment_rental_services_i; $wp_customize->add_setting($setting_id, array( 'default' => '', 'sanitize_callback' => 'esc_url_raw', )); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $setting_id, array( 'label' => sprintf(__('Select Image %d for Post: %s', 'apartment-rental-services'), $apartment_rental_services_i, $post->post_title), 'section' => 'apartment_rental_services_slider_section', ))); } } } $wp_customize->add_setting('apartment_rental_services_button_text',array( 'default' => 'EXPLORE APARTMENT', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_button_text', array( 'settings' => 'apartment_rental_services_button_text', 'section' => 'apartment_rental_services_slider_section', 'label' => __('Add Button Text', 'apartment-rental-services'), 'type' => 'text' )); $wp_customize->add_setting('apartment_rental_services_button_link_slider',array( 'default'=> '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('apartment_rental_services_button_link_slider',array( 'label' => esc_html__('Add Button Link','apartment-rental-services'), 'section'=> 'apartment_rental_services_slider_section', 'type'=> 'url' )); $wp_customize->add_setting('apartment_rental_services_button_text2',array( 'default' => 'TAKE A LOOK AT VR', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_button_text2', array( 'settings' => 'apartment_rental_services_button_text2', 'section' => 'apartment_rental_services_slider_section', 'label' => __('Add Button Text', 'apartment-rental-services'), 'type' => 'text' )); $wp_customize->add_setting('apartment_rental_services_button_link_slider2',array( 'default'=> '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('apartment_rental_services_button_link_slider2',array( 'label' => esc_html__('Add Button Link','apartment-rental-services'), 'section'=> 'apartment_rental_services_slider_section', 'type'=> 'url' )); // Services Section $wp_customize->add_section('apartment_rental_services_service_section', array( 'title' => __('Manage Service Section', 'apartment-rental-services'), 'description' => __('

Manage Service Section

', 'apartment-rental-services'), 'priority' => null, 'panel' => 'apartment_rental_services_panel_area', )); $wp_customize->add_setting('apartment_rental_services_disabled_trending_section', array( 'default' => false, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', 'capability' => 'edit_theme_options', )); $wp_customize->add_control('apartment_rental_services_disabled_trending_section', array( 'settings' => 'apartment_rental_services_disabled_trending_section', 'section' => 'apartment_rental_services_service_section', 'label' => __('Check To Enable Section', 'apartment-rental-services'), 'type' => 'checkbox', )); $wp_customize->add_setting('apartment_rental_services_service_title', array( 'default' => ' ', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options', )); $wp_customize->add_control('apartment_rental_services_service_title', array( 'settings' => 'apartment_rental_services_service_title', 'section' => 'apartment_rental_services_service_section', 'label' => __('Add Service Title', 'apartment-rental-services'), 'type' => 'text', )); $wp_customize->add_setting('apartment_rental_services_service_text', array( 'default' => ' ', 'sanitize_callback' => 'sanitize_text_field', 'capability' => 'edit_theme_options', )); $wp_customize->add_control('apartment_rental_services_service_text', array( 'settings' => 'apartment_rental_services_service_text', 'section' => 'apartment_rental_services_service_section', 'label' => __('Add Service Text', 'apartment-rental-services'), 'type' => 'text', )); $categories = get_categories(); $cat_post = array(); $cat_post['0'] = 'Select'; foreach ($categories as $category) { $cat_post[$category->slug] = $category->name; } $wp_customize->add_setting('apartment_rental_services_posts', array( 'default' => '0', 'sanitize_callback' => 'apartment_rental_services_sanitize_choices', )); $wp_customize->add_control('apartment_rental_services_posts', array( 'type' => 'select', 'choices' => $cat_post, 'label' => __('Select Category to display Latest Post', 'apartment-rental-services'), 'section' => 'apartment_rental_services_service_section', )); //Blog post $wp_customize->add_section('apartment_rental_services_blog_post_settings',array( 'title' => __('Manage Post Section', 'apartment-rental-services'), 'priority' => null, 'panel' => 'apartment_rental_services_panel_area' ) ); // Add Settings and Controls for Post Layout $wp_customize->add_setting('apartment_rental_services_sidebar_post_layout',array( 'default' => 'right', 'sanitize_callback' => 'apartment_rental_services_sanitize_choices' )); $wp_customize->add_control('apartment_rental_services_sidebar_post_layout',array( 'type' => 'radio', 'label' => __('Theme Post Sidebar Position', 'apartment-rental-services'), 'description' => __('This option work for blog page, archive page and search page.', 'apartment-rental-services'), 'section' => 'apartment_rental_services_blog_post_settings', 'choices' => array( 'full' => __('Full','apartment-rental-services'), 'left' => __('Left','apartment-rental-services'), 'right' => __('Right','apartment-rental-services'), 'three-column' => __('Three Columns','apartment-rental-services'), 'four-column' => __('Four Columns','apartment-rental-services'), 'grid' => __('Grid Layout','apartment-rental-services') ), ) ); $wp_customize->add_setting('apartment_rental_services_blog_post_description_option',array( 'default' => 'Excerpt Content', 'sanitize_callback' => 'apartment_rental_services_sanitize_choices' )); $wp_customize->add_control('apartment_rental_services_blog_post_description_option',array( 'type' => 'radio', 'label' => __('Post Description Length','apartment-rental-services'), 'section' => 'apartment_rental_services_blog_post_settings', 'choices' => array( 'No Content' => __('No Content','apartment-rental-services'), 'Excerpt Content' => __('Excerpt Content','apartment-rental-services'), 'Full Content' => __('Full Content','apartment-rental-services'), ), ) ); // Footer Section $wp_customize->add_section('apartment_rental_services_footer', array( 'title' => __('Manage Footer Section','apartment-rental-services'), 'description' => __('

Manage Footer Section

','apartment-rental-services'), 'priority' => null, 'panel' => 'apartment_rental_services_panel_area', )); $wp_customize->add_setting('apartment_rental_services_footer_widget', array( 'default' => false, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox', )); $wp_customize->add_control('apartment_rental_services_footer_widget', array( 'settings' => 'apartment_rental_services_footer_widget', // Corrected setting name 'section' => 'apartment_rental_services_footer', 'label' => __('Check to Enable Footer Widget', 'apartment-rental-services'), 'type' => 'checkbox', )); $wp_customize->add_setting('apartment_rental_services_copyright_line',array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control( 'apartment_rental_services_copyright_line', array( 'section' => 'apartment_rental_services_footer', 'label' => __('Copyright Line','apartment-rental-services'), 'type' => 'text', 'priority' => null, )); // footer coypright color $wp_customize->add_setting('apartment_rental_services_footercoypright_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_footercoypright_color', array( 'settings' => 'apartment_rental_services_footercoypright_color', 'section' => 'apartment_rental_services_footer', 'label' => __('Coypright Color', 'apartment-rental-services'), 'type' => 'color' )); // footer bg color $wp_customize->add_setting('apartment_rental_services_footerbg_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_footerbg_color', array( 'settings' => 'apartment_rental_services_footerbg_color', 'section' => 'apartment_rental_services_footer', 'label' => __('BG Color', 'apartment-rental-services'), 'type' => 'color' )); // footer title color $wp_customize->add_setting('apartment_rental_services_footertitle_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_footertitle_color', array( 'settings' => 'apartment_rental_services_footertitle_color', 'section' => 'apartment_rental_services_footer', 'label' => __('Title Color', 'apartment-rental-services'), 'type' => 'color' )); // footer description color $wp_customize->add_setting('apartment_rental_services_footerdescription_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_footerdescription_color', array( 'settings' => 'apartment_rental_services_footerdescription_color', 'section' => 'apartment_rental_services_footer', 'label' => __('Description Color', 'apartment-rental-services'), 'type' => 'color' )); // footer list color $wp_customize->add_setting('apartment_rental_services_footerlist_color',array( 'default' => '', 'sanitize_callback' => 'apartment_rental_services_sanitize_hex_color', 'capability' => 'edit_theme_options', )); $wp_customize->add_control( 'apartment_rental_services_footerlist_color', array( 'settings' => 'apartment_rental_services_footerlist_color', 'section' => 'apartment_rental_services_footer', 'label' => __('List Color', 'apartment-rental-services'), 'type' => 'color' )); $wp_customize->add_setting('apartment_rental_services_scroll_hide', array( 'default' => false, 'sanitize_callback' => 'apartment_rental_services_sanitize_checkbox' )); $wp_customize->add_control( new WP_Customize_Control($wp_customize,'apartment_rental_services_scroll_hide',array( 'label' => __( 'Check To Show Scroll To Top', 'apartment-rental-services' ), 'section' => 'apartment_rental_services_footer', 'settings' => 'apartment_rental_services_scroll_hide', 'type' => 'checkbox', ))); } add_action( 'customize_register', 'apartment_rental_services_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function apartment_rental_services_customize_preview_js() { wp_enqueue_script( 'apartment_rental_services_customizer', esc_url(get_template_directory_uri()) . '/js/customize-preview.js', array( 'customize-preview' ), '20161510', true ); } add_action( 'customize_preview_init', 'apartment_rental_services_customize_preview_js' );