add_panel( 'automobile_theme_options', array(
'description' => __( 'Basic theme Options', 'automobile' ),
'capability' => 'edit_theme_options',
'priority' => 200,
'title' => __( 'Theme Options', 'automobile' ),
) );
// Breadcrumb Option
$wp_customize->add_section( 'automobile_breadcumb_options', array(
'description' => __( 'Breadcrumbs are a great way of letting your visitors find out where they are on your site with just a glance. You can enable/disable them on homepage and entire site.', 'automobile' ),
'panel' => 'automobile_theme_options',
'title' => __( 'Breadcrumb Options', 'automobile' ),
'priority' => 201,
) );
$wp_customize->add_setting( 'automobile_theme_options[breadcumb_option]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['breadcumb_option'],
'sanitize_callback' => 'automobile_sanitize_checkbox'
) );
$wp_customize->add_control( 'automobile_theme_options[breadcumb_option]', array(
'label' => __( 'Check to enable Breadcrumb', 'automobile' ),
'section' => 'automobile_breadcumb_options',
'settings' => 'automobile_theme_options[breadcumb_option]',
'type' => 'checkbox',
) );
$wp_customize->add_setting( 'automobile_theme_options[breadcumb_onhomepage]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['breadcumb_onhomepage'],
'sanitize_callback' => 'automobile_sanitize_checkbox'
) );
$wp_customize->add_control( 'automobile_theme_options[breadcumb_onhomepage]', array(
'label' => __( 'Check to enable Breadcrumb on Homepage', 'automobile' ),
'section' => 'automobile_breadcumb_options',
'settings' => 'automobile_theme_options[breadcumb_onhomepage]',
'type' => 'checkbox',
) );
$wp_customize->add_setting( 'automobile_theme_options[breadcumb_seperator]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['breadcumb_seperator'],
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( 'automobile_theme_options[breadcumb_seperator]', array(
'input_attrs' => array(
'style' => 'width: 40px;'
),
'label' => __( 'Separator between Breadcrumbs', 'automobile' ),
'section' => 'automobile_breadcumb_options',
'settings' => 'automobile_theme_options[breadcumb_seperator]',
'type' => 'text'
)
);
// Breadcrumb Option End
// Custom CSS Option
$wp_customize->add_section( 'automobile_custom_css', array(
'description' => __( 'Custom/Inline CSS', 'automobile'),
'panel' => 'automobile_theme_options',
'priority' => 203,
'title' => __( 'Custom CSS Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[custom_css]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['custom_css'],
'sanitize_callback' => 'automobile_sanitize_custom_css',
) );
$wp_customize->add_control( 'automobile_theme_options[custom_css]', array(
'label' => __( 'Enter Custom CSS', 'automobile' ),
'priority' => 1,
'section' => 'automobile_custom_css',
'settings' => 'automobile_theme_options[custom_css]',
'type' => 'textarea',
) );
// Custom CSS End
// Excerpt Options
$wp_customize->add_section( 'automobile_excerpt_options', array(
'panel' => 'automobile_theme_options',
'priority' => 204,
'title' => __( 'Excerpt Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[excerpt_length]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['excerpt_length'],
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( 'automobile_theme_options[excerpt_length]', array(
'description' => __('Excerpt length. Default is 30 words', 'automobile'),
'input_attrs' => array(
'min' => 10,
'max' => 200,
'step' => 5,
'style' => 'width: 60px;'
),
'label' => __( 'Excerpt Length (words)', 'automobile' ),
'section' => 'automobile_excerpt_options',
'settings' => 'automobile_theme_options[excerpt_length]',
'type' => 'number',
)
);
$wp_customize->add_setting( 'automobile_theme_options[excerpt_more_text]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['excerpt_more_text'],
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( 'automobile_theme_options[excerpt_more_text]', array(
'label' => __( 'Read More Text', 'automobile' ),
'section' => 'automobile_excerpt_options',
'settings' => 'automobile_theme_options[excerpt_more_text]',
'type' => 'text',
) );
// Excerpt Options End
//Homepage / Frontpage Options
$wp_customize->add_section( 'automobile_homepage_options', array(
'description' => __( 'Only posts that belong to the categories selected here will be displayed on the front page', 'automobile' ),
'panel' => 'automobile_theme_options',
'priority' => 209,
'title' => __( 'Homepage / Frontpage Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[front_page_category]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['front_page_category'],
'sanitize_callback' => 'automobile_sanitize_category_list',
) );
$wp_customize->add_control( new automobile_Customize_Dropdown_Categories_Control( $wp_customize, 'automobile_theme_options[front_page_category]', array(
'label' => __( 'Select Categories', 'automobile' ),
'name' => 'automobile_theme_options[front_page_category]',
'priority' => '6',
'section' => 'automobile_homepage_options',
'settings' => 'automobile_theme_options[front_page_category]',
'type' => 'dropdown-categories',
) ) );
//Homepage / Frontpage Settings End
//
// Layout Options
$wp_customize->add_section( 'automobile_layout', array(
'capability'=> 'edit_theme_options',
'panel' => 'automobile_theme_options',
'priority' => 211,
'title' => __( 'Layout Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[theme_layout]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['theme_layout'],
'sanitize_callback' => 'automobile_sanitize_select',
) );
$layouts = automobile_layouts();
$choices = array();
foreach ( $layouts as $layout ) {
$choices[ $layout['value'] ] = $layout['label'];
}
$wp_customize->add_control( 'automobile_theme_options[theme_layout]', array(
'choices' => $choices,
'label' => __( 'Default Layout', 'automobile' ),
'section' => 'automobile_layout',
'settings' => 'automobile_theme_options[theme_layout]',
'type' => 'select',
) );
$wp_customize->add_setting( 'automobile_theme_options[content_layout]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['content_layout'],
'sanitize_callback' => 'automobile_sanitize_select',
) );
$layouts = automobile_get_archive_content_layout();
$choices = array();
foreach ( $layouts as $layout ) {
$choices[ $layout['value'] ] = $layout['label'];
}
$wp_customize->add_control( 'automobile_theme_options[content_layout]', array(
'choices' => $choices,
'label' => __( 'Archive Content Layout', 'automobile' ),
'section' => 'automobile_layout',
'settings' => 'automobile_theme_options[content_layout]',
'type' => 'select',
) );
$wp_customize->add_setting( 'automobile_theme_options[single_post_image_layout]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['single_post_image_layout'],
'sanitize_callback' => 'automobile_sanitize_select',
) );
$single_post_image_layouts = automobile_single_post_image_layout_options();
$choices = array();
foreach ( $single_post_image_layouts as $single_post_image_layout ) {
$choices[$single_post_image_layout['value']] = $single_post_image_layout['label'];
}
$wp_customize->add_control( 'automobile_theme_options[single_post_image_layout]', array(
'label' => __( 'Single Page/Post Image Layout ', 'automobile' ),
'section' => 'automobile_layout',
'settings' => 'automobile_theme_options[single_post_image_layout]',
'type' => 'select',
'choices' => $choices,
) );
// Layout Options End
// Pagination Options
$pagination_type = $options['pagination_type'];
$automobile_navigation_description = sprintf( __( 'Numeric Option requires WP-PageNavi Plugin.
Infinite Scroll Options requires JetPack Plugin with Infinite Scroll module Enabled.', 'automobile' ), esc_url( 'https://wordpress.org/plugins/wp-pagenavi' ), esc_url( 'https://wordpress.org/plugins/jetpack/' ) );
/**
* Check if navigation type is Jetpack Infinite Scroll and if it is enabled
*/
if ( ( 'infinite-scroll-click' == $pagination_type || 'infinite-scroll-scroll' == $pagination_type ) ) {
if ( ! (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' ) ) ) {
$automobile_navigation_description = sprintf( __( 'Infinite Scroll Options requires JetPack Plugin with Infinite Scroll module Enabled.', 'automobile' ), esc_url( 'https://wordpress.org/plugins/jetpack/' ) );
}
else {
$automobile_navigation_description = '';
}
}
/**
* Check if navigation type is numeric and if Wp-PageNavi Plugin is enabled
*/
else if ( 'numeric' == $pagination_type ) {
if ( !function_exists( 'wp_pagenavi' ) ) {
$automobile_navigation_description = sprintf( __( 'Numeric Option requires WP-PageNavi Plugin.', 'automobile' ), esc_url( 'https://wordpress.org/plugins/wp-pagenavi' ) );
}
else {
$automobile_navigation_description = '';
}
}
$wp_customize->add_section( 'automobile_pagination_options', array(
'description' => $automobile_navigation_description,
'panel' => 'automobile_theme_options',
'priority' => 212,
'title' => __( 'Pagination Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[pagination_type]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['pagination_type'],
'sanitize_callback' => 'sanitize_key',
) );
$pagination_types = automobile_get_pagination_types();
$choices = array();
foreach ( $pagination_types as $pagination_type ) {
$choices[$pagination_type['value']] = $pagination_type['label'];
}
$wp_customize->add_control( 'automobile_theme_options[pagination_type]', array(
'choices' => $choices,
'label' => __( 'Pagination type', 'automobile' ),
'section' => 'automobile_pagination_options',
'settings' => 'automobile_theme_options[pagination_type]',
'type' => 'select',
) );
// Pagination Options End
//Promotion Headline Options
$wp_customize->add_section( 'automobile_promotion_headline_options', array(
'description' => __( 'To disable the fields, simply leave them empty.', 'automobile' ),
'panel' => 'automobile_theme_options',
'priority' => 213,
'title' => __( 'Promotion Headline Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[promotion_headline_option]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['promotion_headline_option'],
'sanitize_callback' => 'automobile_sanitize_select',
) );
$automobile_featured_slider_content_options = automobile_featured_slider_content_options();
$choices = array();
foreach ( $automobile_featured_slider_content_options as $automobile_featured_slider_content_option ) {
$choices[$automobile_featured_slider_content_option['value']] = $automobile_featured_slider_content_option['label'];
}
$wp_customize->add_control( 'automobile_theme_options[promotion_headline_option]', array(
'choices' => $choices,
'label' => __( 'Enable Promotion Headline on', 'automobile' ),
'priority' => '0.5',
'section' => 'automobile_promotion_headline_options',
'settings' => 'automobile_theme_options[promotion_headline_option]',
'type' => 'select',
) );
$wp_customize->add_setting( 'automobile_theme_options[promotion_headline]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['promotion_headline'],
'sanitize_callback' => 'wp_kses_post'
) );
$wp_customize->add_control( 'automobile_theme_options[promotion_headline]', array(
'description' => __( 'Appropriate Words: 10', 'automobile' ),
'label' => __( 'Promotion Headline Text', 'automobile' ),
'priority' => '1',
'section' => 'automobile_promotion_headline_options',
'settings' => 'automobile_theme_options[promotion_headline]',
) );
$wp_customize->add_setting( 'automobile_theme_options[promotion_subheadline]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['promotion_subheadline'],
'sanitize_callback' => 'wp_kses_post'
) );
$wp_customize->add_control( 'automobile_theme_options[promotion_subheadline]', array(
'description' => __( 'Appropriate Words: 15', 'automobile' ),
'label' => __( 'Promotion Subheadline Text', 'automobile' ),
'priority' => '2',
'section' => 'automobile_promotion_headline_options',
'settings' => 'automobile_theme_options[promotion_subheadline]',
) );
$wp_customize->add_setting( 'automobile_theme_options[promotion_headline_button]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['promotion_headline_button'],
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'automobile_theme_options[promotion_headline_button]', array(
'description' => __( 'Appropriate Words: 3', 'automobile' ),
'label' => __( 'Promotion Headline Button Text ', 'automobile' ),
'priority' => '3',
'section' => 'automobile_promotion_headline_options',
'settings' => 'automobile_theme_options[promotion_headline_button]',
'type' => 'text',
) );
$wp_customize->add_setting( 'automobile_theme_options[promotion_headline_url]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['promotion_headline_url'],
'sanitize_callback' => 'esc_url_raw'
) );
$wp_customize->add_control( 'automobile_theme_options[promotion_headline_url]', array(
'label' => __( 'Promotion Headline Link', 'automobile' ),
'priority' => '4',
'section' => 'automobile_promotion_headline_options',
'settings' => 'automobile_theme_options[promotion_headline_url]',
'type' => 'text',
) );
$wp_customize->add_setting( 'automobile_theme_options[promotion_headline_target]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['promotion_headline_target'],
'sanitize_callback' => 'automobile_sanitize_checkbox',
) );
$wp_customize->add_control( 'automobile_theme_options[promotion_headline_target]', array(
'label' => __( 'Check to Open Link in New Window/Tab', 'automobile' ),
'priority' => '5',
'section' => 'automobile_promotion_headline_options',
'settings' => 'automobile_theme_options[promotion_headline_target]',
'type' => 'checkbox',
) );
// Promotion Headline Options End
// Scrollup
$wp_customize->add_section( 'automobile_scrollup', array(
'panel' => 'automobile_theme_options',
'priority' => 215,
'title' => __( 'Scrollup Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[disable_scrollup]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['disable_scrollup'],
'sanitize_callback' => 'automobile_sanitize_checkbox',
) );
$wp_customize->add_control( 'automobile_theme_options[disable_scrollup]', array(
'label' => __( 'Check to disable Scroll Up', 'automobile' ),
'section' => 'automobile_scrollup',
'settings' => 'automobile_theme_options[disable_scrollup]',
'type' => 'checkbox',
) );
// Scrollup End
// Search Options
$wp_customize->add_section( 'automobile_search_options', array(
'description'=> __( 'Change default placeholder text in Search.', 'automobile'),
'panel' => 'automobile_theme_options',
'priority' => 216,
'title' => __( 'Search Options', 'automobile' ),
) );
$wp_customize->add_setting( 'automobile_theme_options[search_text]', array(
'capability' => 'edit_theme_options',
'default' => $defaults['search_text'],
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( 'automobile_theme_options[search_text]', array(
'label' => __( 'Default Display Text in Search', 'automobile' ),
'section' => 'automobile_search_options',
'settings' => 'automobile_theme_options[search_text]',
'type' => 'text',
) );
// Search Options End
//Theme Option End