add_panel( 'ak_blog_panel_id', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __( 'Theme Settings', 'ak-blogs' ), 'description' => __( 'Description of what this panel does.', 'ak-blogs' ), ) ); $wp_customize->add_section( 'ak_blog_left_right', array( 'title' => __( 'General Settings', 'ak-blogs' ), 'priority' => 30, 'panel' => 'ak_blog_panel_id' ) ); $wp_customize->add_setting('ak_blog_width_option',array( 'default' => __('Full Width','ak-blogs'), 'sanitize_callback' => 'ak_blog_sanitize_choices' )); $wp_customize->add_control(new VW_Writer_Blog_Image_Radio_Control($wp_customize, 'ak_blog_width_option', array( 'type' => 'select', 'label' => __('Width Layouts','ak-blogs'), 'description' => __('Here you can change the width layout of Website.','ak-blogs'), 'section' => 'ak_blog_left_right', 'choices' => array( 'Full Width' => get_template_directory_uri().'/images/full-width.png', 'Wide Width' => get_template_directory_uri().'/images/wide-width.png', 'Boxed' => get_template_directory_uri().'/images/boxed-width.png', )))); // Add Settings and Controls for Layout $wp_customize->add_setting('ak_blog_theme_options',array( 'default' => __('Right Sidebar','ak-blogs'), 'sanitize_callback' => 'ak_blog_sanitize_choices' ) ); $wp_customize->add_control('ak_blog_theme_options', array( 'type' => 'select', 'label' => __('Post Sidebar Layout','ak-blogs'), 'description' => __('Here you can change the sidebar layout for posts. ','ak-blogs'), 'section' => 'ak_blog_left_right', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','ak-blogs'), 'Right Sidebar' => __('Right Sidebar','ak-blogs'), 'One Column' => __('One Column','ak-blogs'), 'Three Columns' => __('Three Columns','ak-blogs'), 'Four Columns' => __('Four Columns','ak-blogs'), 'Grid Layout' => __('Grid Layout','ak-blogs') ), )); $wp_customize->add_setting('ak_blog_page_layout',array( 'default' => __('One Column','ak-blogs'), 'sanitize_callback' => 'ak_blog_sanitize_choices' )); $wp_customize->add_control('ak_blog_page_layout',array( 'type' => 'select', 'label' => __('Page Sidebar Layout','ak-blogs'), 'description' => __('Here you can change the sidebar layout for pages. ','ak-blogs'), 'section' => 'ak_blog_left_right', 'choices' => array( 'Left Sidebar' => __('Left Sidebar','ak-blogs'), 'Right Sidebar' => __('Right Sidebar','ak-blogs'), 'One Column' => __('One Column','ak-blogs') ), ) ); $wp_customize->add_section( 'ak_blog_topbar', array( 'title' => __( 'Topbar Settings', 'ak-blogs' ), 'priority' => 30, 'panel' => 'ak_blog_panel_id' ) ); $wp_customize->add_setting('ak_blog_mail_text',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('ak_blog_mail_text',array( 'label' => __('Add Text','ak-blogs'), 'section'=> 'ak_blog_topbar', 'type'=> 'text' )); $wp_customize->add_setting('ak_blog_mail',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('ak_blog_mail',array( 'label' => __('Add Mail Address','ak-blogs'), 'section'=> 'ak_blog_topbar', 'type'=> 'text' )); $wp_customize->add_setting('ak_blog_call_text',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('ak_blog_call_text',array( 'label' => __('Add Text','ak-blogs'), 'section'=> 'ak_blog_topbar', 'type'=> 'text' )); $wp_customize->add_setting('ak_blog_call',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('ak_blog_call',array( 'label' => __('Add Phone Number','ak-blogs'), 'section'=> 'ak_blog_topbar', 'type'=> 'text' )); //Slider $wp_customize->add_section( 'ak_blog_slidersettings' , array( 'title' => __( 'Slider Settings', 'ak-blogs' ), 'priority' => null, 'panel' => 'ak_blog_panel_id' ) ); $wp_customize->add_setting( 'ak_blog_slider_hide_show', array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'ak_blog_switch_sanitization' )); $wp_customize->add_control( new VW_Writer_Blog_Toggle_Switch_Custom_Control( $wp_customize, 'ak_blog_slider_hide_show', array( 'label' => esc_html__( 'Show / Hide Slider','ak-blogs' ), 'section' => 'ak_blog_slidersettings' ))); for ( $count = 1; $count <= 4; $count++ ) { // Add color scheme setting and control. $wp_customize->add_setting( 'ak_blog_slider_page' . $count, array( 'default' => '', 'sanitize_callback' => 'ak_blog_sanitize_dropdown_pages' ) ); $wp_customize->add_control( 'ak_blog_slider_page' . $count, array( 'label' => __( 'Select Slide Image Page', 'ak-blogs' ), 'description' => __('Slider image size (1500 x 600)','ak-blogs'), 'section' => 'ak_blog_slidersettings', 'type' => 'dropdown-pages' ) ); } //content layout $wp_customize->add_setting('ak_blog_slider_content_option',array( 'default' => __('Left','ak-blogs'), 'sanitize_callback' => 'ak_blog_sanitize_choices' )); $wp_customize->add_control(new VW_Writer_Blog_Image_Radio_Control($wp_customize, 'ak_blog_slider_content_option', array( 'type' => 'select', 'label' => __('Slider Content Layouts','ak-blogs'), 'section' => 'ak_blog_slidersettings', 'choices' => array( 'Left' => get_template_directory_uri().'/images/slider-content1.png', 'Center' => get_template_directory_uri().'/images/slider-content2.png', 'Right' => get_template_directory_uri().'/images/slider-content3.png', )))); //Slider excerpt $wp_customize->add_setting( 'ak_blog_slider_excerpt_number', array( 'default' => 30, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'absint', 'sanitize_js_callback' => 'absint', ) ); $wp_customize->add_control( 'ak_blog_slider_excerpt_number', array( 'label' => esc_html__( 'Slider Excerpt length','ak-blogs' ), 'section' => 'ak_blog_slidersettings', 'type' => 'range', 'settings' => 'ak_blog_slider_excerpt_number', 'input_attrs' => array( 'step' => 5, 'min' => 0, 'max' => 50, ), ) ); //Opacity $wp_customize->add_setting('ak_blog_slider_opacity_color',array( 'default' => 0.5, 'sanitize_callback' => 'ak_blog_sanitize_choices' )); $wp_customize->add_control( 'ak_blog_slider_opacity_color', array( 'label' => esc_html__( 'Slider Image Opacity','ak-blogs' ), 'section' => 'ak_blog_slidersettings', 'type' => 'select', 'settings' => 'ak_blog_slider_opacity_color', 'choices' => array( '0' => esc_attr('0','ak-blogs'), '0.1' => esc_attr('0.1','ak-blogs'), '0.2' => esc_attr('0.2','ak-blogs'), '0.3' => esc_attr('0.3','ak-blogs'), '0.4' => esc_attr('0.4','ak-blogs'), '0.5' => esc_attr('0.5','ak-blogs'), '0.6' => esc_attr('0.6','ak-blogs'), '0.7' => esc_attr('0.7','ak-blogs'), '0.8' => esc_attr('0.8','ak-blogs'), '0.9' => esc_attr('0.9','ak-blogs') ), )); //Featured Articals $wp_customize->add_section( 'ak_blog_articles_section' , array( 'title' => __( 'Featured Articles', 'ak-blogs' ), 'priority' => null, 'panel' => 'ak_blog_panel_id' ) ); $wp_customize->add_setting('ak_blog_section_title',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('ak_blog_section_title',array( 'label' => __('Section Title','ak-blogs'), 'section'=> 'ak_blog_articles_section', 'setting'=> 'ak_blog_section_title', 'type'=> 'text' )); $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('ak_blog_featured_articles',array( 'default' => 'select', 'sanitize_callback' => 'ak_blog_sanitize_choices', )); $wp_customize->add_control('ak_blog_featured_articles',array( 'type' => 'select', 'choices' => $cat_post, 'label' => __('Select Category to display Articles','ak-blogs'), 'description' => __('Image size (270 x 345)','ak-blogs'), 'section' => 'ak_blog_articles_section', )); //Article excerpt $wp_customize->add_setting( 'ak_blog_article_excerpt_number', array( 'default' => 30, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'absint', 'sanitize_js_callback' => 'absint', ) ); $wp_customize->add_control( 'ak_blog_article_excerpt_number', array( 'label' => esc_html__( 'Article Excerpt length','ak-blogs' ), 'section' => 'ak_blog_articles_section', 'type' => 'range', 'settings' => 'ak_blog_article_excerpt_number', 'input_attrs' => array( 'step' => 5, 'min' => 0, 'max' => 50, ), ) ); //Blog Post $wp_customize->add_section('ak_blog_blog_post',array( 'title' => __('Blog Post Settings','ak-blogs'), 'panel' => 'ak_blog_panel_id', )); $wp_customize->add_setting( 'ak_blog_toggle_postdate',array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'ak_blog_switch_sanitization' ) ); $wp_customize->add_control( new VW_Writer_Blog_Toggle_Switch_Custom_Control( $wp_customize, 'ak_blog_toggle_postdate',array( 'label' => esc_html__( 'Post Date','ak-blogs' ), 'section' => 'ak_blog_blog_post' ))); $wp_customize->add_setting( 'ak_blog_toggle_author',array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'ak_blog_switch_sanitization' ) ); $wp_customize->add_control( new VW_Writer_Blog_Toggle_Switch_Custom_Control( $wp_customize, 'ak_blog_toggle_author',array( 'label' => esc_html__( 'Author','ak-blogs' ), 'section' => 'ak_blog_blog_post' ))); $wp_customize->add_setting( 'ak_blog_toggle_comments',array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'ak_blog_switch_sanitization' ) ); $wp_customize->add_control( new VW_Writer_Blog_Toggle_Switch_Custom_Control( $wp_customize, 'ak_blog_toggle_comments',array( 'label' => esc_html__( 'Comments','ak-blogs' ), 'section' => 'ak_blog_blog_post' ))); $wp_customize->add_setting( 'ak_blog_excerpt_number', array( 'default' => 30, 'type' => 'theme_mod', 'transport' => 'refresh', 'sanitize_callback' => 'absint', 'sanitize_js_callback' => 'absint', ) ); $wp_customize->add_control( 'ak_blog_excerpt_number', array( 'label' => esc_html__( 'Excerpt length','ak-blogs' ), 'section' => 'ak_blog_blog_post', 'type' => 'range', 'settings' => 'ak_blog_excerpt_number', 'input_attrs' => array( 'step' => 5, 'min' => 0, 'max' => 50, ), ) ); //Content Creation $wp_customize->add_section( 'ak_blog_content_section' , array( 'title' => __( 'Customize Home Page', 'ak-blogs' ), 'priority' => null, 'panel' => 'ak_blog_panel_id' ) ); $wp_customize->add_setting('ak_blog_content_creation_main_control', array( 'sanitize_callback' => 'esc_html', ) ); $homepage= get_option( 'page_on_front' ); $wp_customize->add_control( new VW_Writer_Blog_Content_Creation( $wp_customize, 'ak_blog_content_creation_main_control', array( 'options' => array( esc_html__( 'First select static page in homepage setting for front page.Below given edit button is to customize Home Page. Just click on the edit option, add whatever elements you want to include in the homepage, save the changes and you are good to go.','ak-blogs' ), ), 'section' => 'ak_blog_content_section', 'button_url' => admin_url( 'post.php?post='.$homepage.'&action=edit'), 'button_text' => esc_html__( 'Edit', 'ak-blogs' ), ) ) ); //Footer Text $wp_customize->add_section('ak_blog_footer',array( 'title' => __('Footer','ak-blogs'), 'description'=> __('This section will appear in the footer','ak-blogs'), 'panel' => 'ak_blog_panel_id', )); $wp_customize->add_setting('ak_blog_footer_text',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('ak_blog_footer_text',array( 'label' => __('Copyright Text','ak-blogs'), 'section'=> 'ak_blog_footer', 'setting'=> 'ak_blog_footer_text', 'type'=> 'text' )); $wp_customize->add_setting( 'ak_blog_hide_show_scroll',array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => 'ak_blog_switch_sanitization' )); $wp_customize->add_control( new VW_Writer_Blog_Toggle_Switch_Custom_Control( $wp_customize, 'ak_blog_hide_show_scroll',array( 'label' => esc_html__( 'Show / Hide Scroll To Top','ak-blogs' ), 'section' => 'ak_blog_footer' ))); $wp_customize->add_setting('ak_blog_scroll_top_alignment',array( 'default' => __('Right','ak-blogs'), 'sanitize_callback' => 'ak_blog_sanitize_choices' )); $wp_customize->add_control(new VW_Writer_Blog_Image_Radio_Control($wp_customize, 'ak_blog_scroll_top_alignment', array( 'type' => 'select', 'label' => __('Scroll To Top','ak-blogs'), 'section' => 'ak_blog_footer', 'settings' => 'ak_blog_scroll_top_alignment', 'choices' => array( 'Left' => get_template_directory_uri().'/images/layout1.png', 'Center' => get_template_directory_uri().'/images/layout2.png', 'Right' => get_template_directory_uri().'/images/layout3.png' )))); } add_action( 'customize_register', 'ak_blog_customize_register' ); load_template( trailingslashit( get_template_directory() ) . '/inc/logo/logo-resizer.php' ); /** * Singleton class for handling the theme's customizer integration. * * @since 1.0.0 * @access public */ final class VW_Writer_Blog_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() ) . '/inc/section-pro.php' ); // Register custom section types. $manager->register_section_type( 'Ak_Blog_Customize_Section_Pro' ); // Register sections. $manager->add_section(new Ak_Blog_Customize_Section_Pro($manager,'example_2',array( 'priority' => 1, 'title' => esc_html__( 'Documentation', 'ak-blogs' ), 'pro_text' => esc_html__( 'Readmore', 'ak-blogs' ), 'pro_url' => '#', ))); } /** * Loads theme customizer CSS. * * @since 1.0.0 * @access public * @return void */ public function enqueue_control_scripts() { wp_enqueue_script( 'ak-blogs-customize-controls', trailingslashit( get_template_directory_uri() ) . '/js/customize-controls.js', array( 'customize-controls' ) ); wp_enqueue_style( 'ak-blogs-customize-controls', trailingslashit( get_template_directory_uri() ) . '/css/customize-controls.css' ); } } // Doing this customizer thang! VW_Writer_Blog_Customize::get_instance();