add_panel( 'blogpost_general_panel', array(
'priority' => 250,
'capability' => 'edit_theme_options',
'title' => __( 'General settings' , 'vh'),
'description' => __( 'You can configure your general theme settings here' , 'vh')
) );
// Add Header setting panel and configure settings inside it
$wp_customize->add_panel( 'blogpost_social_panel', array(
'priority' => 250,
'capability' => 'edit_theme_options',
'title' => __( 'Side-menu settings' , 'vh'),
'description' => __( 'You can configure your theme side-menu settings here.' , 'vh')
) );
// Add 404 setting panel and configure settings inside it
$wp_customize->add_panel( 'blogpost_404_panel', array(
'priority' => 250,
'capability' => 'edit_theme_options',
'title' => __( '404 page' , 'vh'),
'description' => __( 'You can configure your themes 404 page settings here.' , 'vh')
) );
// Website logo
$wp_customize->add_section( 'blogpost_general_logo', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'title' => __( 'Website logo' , 'vh'),
'description' => __( 'Please upload your logo, recommended logo size should be between 262x80' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting( 'blogpost_logo', array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'blogpost_logo', array(
'label' => __( 'Website logo', 'vh' ),
'section' => 'blogpost_general_logo',
'settings' => 'blogpost_logo',
) ) );
// Logo retina ready
$wp_customize->add_setting( 'blogpost_logo_retina_ready', array( 'sanitize_callback' => 'blogpost_sanitize_checkbox' ) );
$wp_customize->add_control(
'blogpost_logo_retina_ready',
array(
'label' => 'Website logo is Retina ready',
'description' => 'You have to uplaod website logo which is 2x in dimensions. It will automatically scaled down for normal displays and prepared for High resolution displays.',
'section' => 'blogpost_general_logo',
'type' => 'checkbox',
)
);
// Page layout
$wp_customize->add_section( 'blogpost_general_layout', array(
'priority' => 20,
'capability' => 'edit_theme_options',
'title' => __( 'Layout' , 'vh'),
'description' => __( 'Select a layout style.
(full, left side sidebar, right side sidebar)' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting(
'blogpost_layout',
array(
'default' => 'full',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control(
'blogpost_layout',
array(
'type' => 'radio',
'label' => 'Layout',
'section' => 'blogpost_general_layout',
'choices' => array(
'full' => 'Full',
'right' => 'Right'
)
)
);
// Search background
$wp_customize->add_section( 'blogpost_general_search_bg', array(
'priority' => 40,
'capability' => 'edit_theme_options',
'title' => __( 'Search background' , 'vh'),
'description' => __( 'Upload an image to use as your search background' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting( 'blogpost_search_background', array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'blogpost_search_background', array(
'label' => __( 'Search background', 'vh' ),
'section' => 'blogpost_general_search_bg',
'settings' => 'blogpost_search_background',
) ) );
// Show comments at sidebar
$wp_customize->add_section( 'blogpost_general_sidebar_comments', array(
'priority' => 50,
'capability' => 'edit_theme_options',
'title' => __( 'Show comments at sidebar' , 'vh'),
'description' => __( 'Remove comment form bottom of the post and relocate it at sidebar.' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting( 'blogpost_sidebar_comments', array( 'sanitize_callback' => 'blogpost_sanitize_checkbox' ) );
$wp_customize->add_control(
'blogpost_sidebar_comments',
array(
'label' => 'Show comments at sidebar',
'section' => 'blogpost_general_sidebar_comments',
'type' => 'checkbox',
)
);
// Side menu image
$wp_customize->add_section( 'blogpost_general_side_image', array(
'priority' => 60,
'capability' => 'edit_theme_options',
'title' => __( 'Side menu image' , 'vh'),
'description' => __( 'Upload an image to use as your side menu background' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting( 'blogpost_side_menu_img', array( 'sanitize_callback' => 'esc_url_raw' ) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'blogpost_side_menu_img', array(
'label' => __( 'Side menu image', 'vh' ),
'section' => 'blogpost_general_side_image',
'settings' => 'blogpost_side_menu_img',
) ) );
// Blog columns
$wp_customize->add_section( 'blogpost_general_blog_columns', array(
'priority' => 70,
'capability' => 'edit_theme_options',
'title' => __( 'Blog columns' , 'vh'),
'description' => __( 'Select in how many columns will the blog posts be divided.' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting(
'blogpost_blog_columns',
array(
'default' => '3',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control(
'blogpost_blog_columns',
array(
'type' => 'select',
'label' => 'Blog columns',
'section' => 'blogpost_general_blog_columns',
'choices' => array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6'
)
)
);
// Scroll to top
$wp_customize->add_section( 'blogpost_general_scrolltotop', array(
'priority' => 100,
'capability' => 'edit_theme_options',
'title' => __( 'Scroll to top' , 'vh'),
'description' => __( 'Do you want to enable "Scroll to Top" button?' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting( 'blogpost_scrolltotop', array( 'sanitize_callback' => 'blogpost_sanitize_checkbox' ) );
$wp_customize->add_control(
'blogpost_scrolltotop',
array(
'label' => 'Scroll to top',
'section' => 'blogpost_general_scrolltotop',
'type' => 'checkbox',
)
);
// Featured post
$wp_customize->add_section( 'blogpost_featured_post', array(
'priority' => 110,
'capability' => 'edit_theme_options',
'title' => __( 'Featured post' , 'vh'),
'description' => __( 'The ID of the featured post to show at the front page.' , 'vh'),
'panel' => 'blogpost_general_panel'
) );
$wp_customize->add_setting( 'blogpost_featured_post_id', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_featured_post_id',
array(
'label' => 'Featured post',
'section' => 'blogpost_featured_post',
'type' => 'text',
)
);
// Header twitter
$wp_customize->add_section( 'blogpost_social_twitter', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'title' => __( 'Twitter URL' , 'vh'),
'description' => __( 'Twitter URL for your menu social icon.' , 'vh'),
'panel' => 'blogpost_social_panel'
) );
$wp_customize->add_setting( 'blogpost_socialtwitter', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_socialtwitter',
array(
'label' => 'Twitter URL',
'section' => 'blogpost_social_twitter',
'type' => 'text',
)
);
// Header facebook
$wp_customize->add_section( 'blogpost_social_facebook', array(
'priority' => 20,
'capability' => 'edit_theme_options',
'title' => __( 'Facebook URL' , 'vh'),
'description' => __( 'Facebook URL for your menu social icon.' , 'vh'),
'panel' => 'blogpost_social_panel'
) );
$wp_customize->add_setting( 'blogpost_socialfacebook', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_socialfacebook',
array(
'label' => 'Facebook URL',
'section' => 'blogpost_social_facebook',
'type' => 'text',
)
);
// Header google plus
$wp_customize->add_section( 'blogpost_social_gplus', array(
'priority' => 30,
'capability' => 'edit_theme_options',
'title' => __( 'Google+ URL' , 'vh'),
'description' => __( 'Google+ URL for your menu social icon.' , 'vh'),
'panel' => 'blogpost_social_panel'
) );
$wp_customize->add_setting( 'blogpost_socialgplus', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_socialgplus',
array(
'label' => 'Google+ URL',
'section' => 'blogpost_social_gplus',
'type' => 'text',
)
);
// Header pinterest
$wp_customize->add_section( 'blogpost_social_pinterest', array(
'priority' => 40,
'capability' => 'edit_theme_options',
'title' => __( 'Pinterest URL' , 'vh'),
'description' => __( 'Pinterest URL for your menu social icon.' , 'vh'),
'panel' => 'blogpost_social_panel'
) );
$wp_customize->add_setting( 'blogpost_socialpinterest', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_socialpinterest',
array(
'label' => 'Pinterest URL',
'section' => 'blogpost_social_pinterest',
'type' => 'text',
)
);
// Header instagram
$wp_customize->add_section( 'blogpost_social_instagram', array(
'priority' => 50,
'capability' => 'edit_theme_options',
'title' => __( 'Instagram URL' , 'vh'),
'description' => __( 'Instagram URL for your menu social icon.' , 'vh'),
'panel' => 'blogpost_social_panel'
) );
$wp_customize->add_setting( 'blogpost_socialinstagram', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_socialinstagram',
array(
'label' => 'Instagram URL',
'section' => 'blogpost_social_instagram',
'type' => 'text',
)
);
// Header vkontakte
$wp_customize->add_section( 'blogpost_social_vkontakte', array(
'priority' => 60,
'capability' => 'edit_theme_options',
'title' => __( 'VKontakte URL' , 'vh'),
'description' => __( 'VKontakte URL for your menu social icon.' , 'vh'),
'panel' => 'blogpost_social_panel'
) );
$wp_customize->add_setting( 'blogpost_socialvkontakte', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_socialvkontakte',
array(
'label' => 'VKontakte URL',
'section' => 'blogpost_social_vkontakte',
'type' => 'text',
)
);
// 404 page title
$wp_customize->add_section( 'blogpost_404_page_title', array(
'priority' => 40,
'capability' => 'edit_theme_options',
'title' => __( '404 Page Title' , 'vh'),
'description' => __( 'Set the page title that is displayed on the 404 Error Page.' , 'vh'),
'panel' => 'blogpost_404_panel'
) );
$wp_customize->add_setting( 'blogpost_404_title', array( 'default' => 'This is somewhat embarrassing, isn\'t it?', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_404_title',
array(
'label' => '404 Page Title',
'section' => 'blogpost_404_page_title',
'type' => 'text',
)
);
// 404 page message
$wp_customize->add_section( 'blogpost_404_page_message', array(
'priority' => 40,
'capability' => 'edit_theme_options',
'title' => __( '404 Page Message' , 'vh'),
'description' => __( 'Set the message that is displayed on the 404 Error Page.' , 'vh'),
'panel' => 'blogpost_404_panel'
) );
$wp_customize->add_setting( 'blogpost_404_message', array( 'default' => 'It seems we can\'t find what you\'re looking for. Perhaps searching, or one of the links below, can help.', 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_404_message',
array(
'label' => '404 Page Title',
'section' => 'blogpost_404_page_message',
'type' => 'text',
)
);
// Social links
$wp_customize->add_section( new blogpost_Customized_Section( $wp_customize, 'blogpost_social_links', array(
'priority' => 300,
'capability' => 'edit_theme_options'
) )
);
$wp_customize->add_setting( 'blogpost_fake_field', array( 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control(
'blogpost_fake_field',
array(
'label' => '',
'section' => 'blogpost_social_links',
'type' => 'text'
)
);
}
add_action( 'customize_register', 'blogpost_customize_register' );
if ( class_exists( 'WP_Customize_Section' ) && !class_exists( 'blogpost_Customized_Section' ) ) {
class blogpost_Customized_Section extends WP_Customize_Section {
public function render() {
$classes = 'accordion-section control-section control-section-' . $this->type;
?>