add_panel('advance_one_page_panel_id', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Theme Settings', 'advance-one-page'), 'description' => __('Description of what this panel does.', 'advance-one-page'), )); //Top Bar $wp_customize->add_section('advance_one_page_topbar',array( 'title' => __('Topbar Section','advance-one-page'), 'description' => __('Add topbar content','advance-one-page'), 'priority' => null, 'panel' => 'advance_one_page_panel_id', )); $wp_customize->add_setting('advance_one_page_call1',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('advance_one_page_call1',array( 'label' => __('Phone Number','advance-one-page'), 'section' => 'advance_one_page_topbar', 'type' => 'text' )); $wp_customize->add_setting('advance_one_page_mail1',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('advance_one_page_mail1',array( 'label' => __('Mail Address','advance-one-page'), 'section' => 'advance_one_page_topbar', 'type' => 'text' )); $wp_customize->add_setting('advance_one_page_facebook_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('advance_one_page_facebook_url',array( 'label' => __('Add Facebook link','advance-one-page'), 'section' => 'advance_one_page_topbar', 'setting' => 'advance_one_page_facebook_url', 'type' => 'url' )); $wp_customize->add_setting('advance_one_page_twitter_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('advance_one_page_twitter_url',array( 'label' => __('Add Twitter link','advance-one-page'), 'section' => 'advance_one_page_topbar', 'setting' => 'advance_one_page_twitter_url', 'type' => 'url' )); $wp_customize->add_setting('advance_one_page_insta_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('advance_one_page_insta_url',array( 'label' => __('Add Instagram link','advance-one-page'), 'section' => 'advance_one_page_topbar', 'setting' => 'advance_one_page_insta_url', 'type' => 'url' )); $wp_customize->add_setting('advance_one_page_pinterest_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('advance_one_page_pinterest_url',array( 'label' => __('Add Pintrest link','advance-one-page'), 'section' => 'advance_one_page_topbar', 'setting' => 'advance_one_page_pinterest_url', 'type' => 'url' )); $wp_customize->add_setting('advance_one_page_google_plus_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('advance_one_page_google_plus_url',array( 'label' => __('Add Google Plus link','advance-one-page'), 'section' => 'advance_one_page_topbar', 'setting' => 'advance_one_page_google_plus_url', 'type' => 'url' )); $wp_customize->add_setting('advance_one_page_youtube_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('advance_one_page_youtube_url',array( 'label' => __('Add Youtube link','advance-one-page'), 'section' => 'advance_one_page_topbar', 'setting' => 'advance_one_page_youtube_url', 'type' => 'url' )); //Slider $wp_customize->add_section( 'advance_one_page_slider' , array( 'title' => __( 'Slider Settings', 'advance-one-page' ), 'priority' => null, 'panel' => 'advance_one_page_panel_id' ) ); $wp_customize->add_setting('advance_one_page_slider_hide',array( 'default' => 'false', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('advance_one_page_slider_hide',array( 'type' => 'checkbox', 'label' => __('Show / Hide slider','advance-one-page'), 'section' => 'advance_one_page_slider' )); for ( $count = 1; $count <= 4; $count++ ) { $wp_customize->add_setting( 'advance_one_page_slider_page' . $count, array( 'default' => '', 'sanitize_callback' => 'advance_one_page_sanitize_dropdown_pages' ) ); $wp_customize->add_control( 'advance_one_page_slider_page' . $count, array( 'label' => __( 'Select Slide Image Page', 'advance-one-page' ), 'description' => __('Size of image should be 1600 x 633','advance-one-page'), 'section' => 'advance_one_page_slider', 'type' => 'dropdown-pages' ) ); } // Feature Section $wp_customize->add_section('advance_one_page_feature_section',array( 'title' => __('Our Features ','advance-one-page'), 'description'=> __('This section will appear below the slider.','advance-one-page'), 'panel' => 'advance_one_page_panel_id', )); for ( $count = 0; $count <= 2; $count++ ) { $wp_customize->add_setting( 'advance_one_page_features' . $count, array( 'default' => '', 'sanitize_callback' => 'advance_one_page_sanitize_dropdown_pages' )); $wp_customize->add_control( 'advance_one_page_features' . $count, array( 'label' => __( 'Select Service Page', 'advance-one-page' ), 'section' => 'advance_one_page_feature_section', 'type' => 'dropdown-pages' )); } //Our Services $wp_customize->add_section('advance_one_page_category_section',array( 'title' => __('Our Services','advance-one-page'), 'description' => '', 'priority' => null, 'panel' => 'advance_one_page_panel_id', )); $wp_customize->add_setting('advance_one_page_our_services_title',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('advance_one_page_our_services_title',array( 'label' => __('Section Title','advance-one-page'), 'section' => 'advance_one_page_category_section', 'setting' => 'advance_one_page_our_services_title', 'type' => 'text' )); // category $categories = get_categories(); $cats = array(); $i = 0; $cat_post[]= 'select'; foreach($categories as $category){ if($i==0){ $default = $category->slug; $i++; } $cat_post[$category->slug] = $category->name; } $wp_customize->add_setting('advance_one_page_category3',array( 'default' => 'select', 'sanitize_callback' => 'advance_one_page_sanitize_choices', )); $wp_customize->add_control('advance_one_page_category3',array( 'type' => 'select', 'choices' => $cat_post, 'label' => __('Select Category to display Latest Post','advance-one-page'), 'description' => __('Size of image should be 570 x 380','advance-one-page'), 'section' => 'advance_one_page_category_section', )); //footer $wp_customize->add_section('advance_one_page_footer_section', array( 'title' => __('Footer Text', 'advance-one-page'), 'description' => __('Add some text for footer like copyright etc.', 'advance-one-page'), 'priority' => null, 'panel' => 'advance_one_page_panel_id', )); $wp_customize->add_setting('advance_one_page_footer_copy', array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('advance_one_page_footer_copy', array( 'label' => __('Copyright Text', 'advance-one-page'), 'section' => 'advance_one_page_footer_section', 'type' => 'text', )); //Layouts $wp_customize->add_section('advance_one_page_left_right', array( 'title' => __('Sidebar Layout Settings', 'advance-one-page'), 'priority' => null, 'panel' => 'advance_one_page_panel_id', )); $wp_customize->add_setting('advance_one_page_layout_options', array( 'default' => __('Right Sidebar', 'advance-one-page'), 'sanitize_callback' => 'advance_one_page_sanitize_choices', )); $wp_customize->add_control('advance_one_page_layout_options',array( 'type' => 'radio', 'label' => __('Change Layouts', 'advance-one-page'), 'section' => 'advance_one_page_left_right', 'choices' => array( 'Left Sidebar' => __('Left Sidebar', 'advance-one-page'), 'Right Sidebar' => __('Right Sidebar', 'advance-one-page'), 'One Column' => __('One Column', 'advance-one-page'), 'Grid Layout' => __('Grid Layout', 'advance-one-page') ), )); } add_action('customize_register', 'advance_one_page_customize_register'); /** * Singleton class for handling the theme's customizer integration. * * @since 1.0.0 * @access public */ final class Advance_One_Page_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 conadvance_one_page_Customizetrols. 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()).'/inc/section-pro.php'); // Register custom section types. $manager->register_section_type('Advance_One_Page_Customize_Section_Pro'); // Register sections. $manager->add_section( new Advance_One_Page_Customize_Section_Pro( $manager, 'example_1', array( 'priority' => 9, 'title' => esc_html__('One Page Pro Theme', 'advance-one-page'), 'pro_text' => esc_html__('Go Pro', 'advance-one-page'), 'pro_url' => esc_url('https://www.themeshopy.com/themes/one-page-wordpress-theme/'), ) ) ); } /** * Loads theme customizer CSS. * * @since 1.0.0 * @access public * @return void */ public function enqueue_control_scripts() { wp_enqueue_script('advance-one-page-customize-controls', trailingslashit(get_template_directory_uri()).'/js/customize-controls.js', array('customize-controls')); wp_enqueue_style('advance-one-page-customize-controls', trailingslashit(get_template_directory_uri()).'/css/customize-controls.css'); } } // Doing this customizer thang! Advance_One_Page_Customize::get_instance();