array(
'link' => esc_url('http://themepuls.com/support-forum/'),
'text' => __('Free Support', 'bikaro'),
),
'documentation' => array(
'link' => esc_url('http://themepuls.com/theme-instruction/bikaro/'),
'text' => __('Documentation', 'bikaro'),
),
'demo' => array(
'link' => esc_url('http://demo.themepuls.com/bikaro/'),
'text' => __('View Demo', 'bikaro'),
),
'rating' => array(
'link' => esc_url('http://wordpress.org/themes/bikaro/'),
'text' => __('Rate this theme', 'bikaro'),
),
);
foreach ($important_links as $important_link) {
echo '
' . esc_attr($important_link['text']) . '
';
}
?>
add_section('bikaro_important_links', array(
'priority' => 700,
'title' => __('About bikaro', 'bikaro'),
));
/**
* This setting has the dummy Sanitization function as it contains no value to be sanitized
*/
$wp_customize->add_setting('bikaro_important_links', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_links_sanitize'
));
$wp_customize->add_control(new bikaro_Important_Links($wp_customize, 'important_links', array(
'section' => 'bikaro_important_links',
'settings' => 'bikaro_important_links'
)));
// Theme Important Links Ended
// Start of the Header Options
// Header Options Area
$wp_customize->add_panel('bikaro_header_options', array(
'priority' => 500,
'capabitity' => 'edit_theme_options',
'title' => __('Header Options', 'bikaro')
));
// Header Logo upload option
$wp_customize->add_section('bikaro_header_logo', array(
'priority' => 1,
'title' => __('Header Logo', 'bikaro'),
'panel' => 'bikaro_header_options'
));
$wp_customize->add_setting('bikaro_header_logo_image', array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bikaro_header_logo_image', array(
'label' => __('Upload logo for your header. Recommended image size is 100 X 100 pixels.', 'bikaro'),
'section' => 'bikaro_header_logo',
'setting' => 'bikaro_header_logo_image'
)));
// Header logo and text display type option
$wp_customize->add_setting('bikaro_show_header_logo_text', array(
'default' => 'text_only',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control('bikaro_show_header_logo_text', array(
'type' => 'radio',
'label' => __('Choose the option that you want.', 'bikaro'),
'section' => 'bikaro_header_logo',
'choices' => array(
'logo_only' => __( 'Header Logo Only', 'bikaro' ),
'text_only' => __( 'Header Text Only', 'bikaro' ),
'both' => __( 'Show Both', 'bikaro' ),
'none' => __( 'Disable', 'bikaro' )
)
));
// Sticky Menu activate option
$wp_customize->add_section('bikaro_sticky_menu_activate_section', array(
'priority' => 2,
'title' => __('Sticky Menu', 'bikaro'),
'panel' => 'bikaro_header_options'
));
$wp_customize->add_setting('bikaro_sticky_menu_activate', array(
'default' => 1,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_checkbox_sanitize'
));
$wp_customize->add_control('bikaro_sticky_menu_activate', array(
'type' => 'checkbox',
'label' => __('Check to make the primary menu sticky.', 'bikaro'),
'section' => 'bikaro_sticky_menu_activate_section',
'settings' => 'bikaro_sticky_menu_activate'
));
// Header image position option
$wp_customize->add_section('bikaro_header_image_position_section', array(
'priority' => 3,
'title' => __('Header Image Position', 'bikaro'),
'panel' => 'bikaro_header_options'
));
$wp_customize->add_setting('bikaro_header_image_position', array(
'default' => 'above',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control('bikaro_header_image_position', array(
'type' => 'radio',
'label' => __('Choose top header image display position.', 'bikaro'),
'section' => 'bikaro_header_image_position_section',
'choices' => array(
'above' => __( 'Position Above (Default): Display the Header image just above the site title and main menu part.', 'bikaro' ),
'below' => __( 'Position Below: Display the Header image just below the site title and main menu part.', 'bikaro' )
)
));
// End of the Header Options
// Start of the Design Options
$wp_customize->add_panel('bikaro_design_options', array(
'priority' => 505,
'capabitity' => 'edit_theme_options',
'title' => __('Design Options', 'bikaro')
));
// site layout setting
$wp_customize->add_section('bikaro_site_layout_section', array(
'priority' => 2,
'title' => __('Site Layout', 'bikaro'),
'panel' => 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_site_layout', array(
'default' => 'wide_layout',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control('bikaro_site_layout', array(
'type' => 'radio',
'label' => __('Choose your site layout. The change is reflected in whole site.', 'bikaro'),
'choices' => array(
'boxed_layout' => __( 'Boxed layout', 'bikaro' ),
'wide_layout' => __( 'Wide layout', 'bikaro' ),
),
'section' => 'bikaro_site_layout_section'
));
class bikaro_Image_Radio_Control extends WP_Customize_Control {
public function render_content() {
if ( empty( $this->choices ) )
return;
$name = '_customize-radio-' . $this->id;
?>
label ); ?>
add_section('bikaro_default_layout_section', array(
'priority' => 3,
'title' => __('Default layout', 'bikaro'),
'panel'=> 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_default_layout', array(
'default' => 'both_sidebar',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control(new bikaro_Image_Radio_Control($wp_customize, 'bikaro_default_layout', array(
'type' => 'radio',
'label' => __('Select default layout. This layout will be reflected in whole site archives, search etc. The layout for a single post and page can be controlled from below options.', 'bikaro'),
'section' => 'bikaro_default_layout_section',
'settings' => 'bikaro_default_layout',
'choices' => array(
'right_sidebar' => bikaro_ADMIN_IMAGES_URL . '/right_sidebar.png',
'left_sidebar' => bikaro_ADMIN_IMAGES_URL . '/left_sidebar.png',
'both_sidebar' => bikaro_ADMIN_IMAGES_URL . '/both_sidebar.jpg',
'no_sidebar_full_width' => bikaro_ADMIN_IMAGES_URL . '/no_sidebar_full_width_layout.png',
'no_sidebar_content_centered' => bikaro_ADMIN_IMAGES_URL . '/no_sidebar_content_centered_layout.png'
)
)));
// default layout for pages
$wp_customize->add_section('bikaro_default_page_layout_section', array(
'priority' => 4,
'title' => __('Default layout for pages only', 'bikaro'),
'panel'=> 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_pages_default_layout', array(
'default' => 'both_sidebar',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control(new bikaro_Image_Radio_Control($wp_customize, 'bikaro_pages_default_layout', array(
'type' => 'radio',
'label' => __('Select default layout for pages. This layout will be reflected in all pages unless unique layout is set for specific page.', 'bikaro'),
'section' => 'bikaro_default_page_layout_section',
'settings' => 'bikaro_pages_default_layout',
'choices' => array(
'right_sidebar' => bikaro_ADMIN_IMAGES_URL . '/right_sidebar.png',
'left_sidebar' => bikaro_ADMIN_IMAGES_URL . '/left_sidebar.png',
'both_sidebar' => bikaro_ADMIN_IMAGES_URL . '/both_sidebar.jpg',
'no_sidebar_full_width' => bikaro_ADMIN_IMAGES_URL . '/no_sidebar_full_width_layout.png',
'no_sidebar_content_centered' => bikaro_ADMIN_IMAGES_URL . '/no_sidebar_content_centered_layout.png'
)
)));
// default layout for single posts
$wp_customize->add_section('bikaro_default_single_posts_layout_setting', array(
'priority' => 5,
'title' => __('Default layout for single posts only', 'bikaro'),
'panel'=> 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_single_posts_default_layout', array(
'default' => 'both_sidebar',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control(new bikaro_Image_Radio_Control($wp_customize, 'bikaro_single_posts_default_layout', array(
'type' => 'radio',
'label' => __('Select default layout for single posts. This layout will be reflected in all single posts unless unique layout is set for specific post.', 'bikaro'),
'section' => 'bikaro_default_single_posts_layout_setting',
'settings' => 'bikaro_single_posts_default_layout',
'choices' => array(
'right_sidebar' => bikaro_ADMIN_IMAGES_URL . '/right_sidebar.png',
'left_sidebar' => bikaro_ADMIN_IMAGES_URL . '/left_sidebar.png',
'both_sidebar' => bikaro_ADMIN_IMAGES_URL . '/both_sidebar.jpg',
'no_sidebar_full_width' => bikaro_ADMIN_IMAGES_URL . '/no_sidebar_full_width_layout.png',
'no_sidebar_content_centered' => bikaro_ADMIN_IMAGES_URL . '/no_sidebar_content_centered_layout.png'
)
)));
// blog posts display type
$wp_customize->add_section('bikaro_blog_posts_display_section', array(
'priority' => 6,
'title' => __('Blog Posts display type', 'bikaro'),
'panel' => 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_archive_display_type', array(
'default' => 'blog_medium',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control('bikaro_archive_display_type', array(
'type' => 'radio',
'label' => __('Choose the display type for your blog or category page', 'bikaro'),
'choices' => array(
'blog_large' => __( 'Large image and summary text', 'bikaro' ),
'blog_medium' => __( 'Medium image and summary text', 'bikaro' ),
'blog_medium_alternate' => __( 'Alternate position medium image and summary text', 'bikaro' ),
'blog_full_content' => __( 'Large image and full content', 'bikaro' ),
),
'section' => 'bikaro_blog_posts_display_section'
));
// Site primary color option
$wp_customize->add_section('bikaro_primary_color_section', array(
'priority' => 7,
'title' => __('Primary color option', 'bikaro'),
'panel' => 'bikaro_design_options',
));
$wp_customize->add_setting('bikaro_primary_color', array(
'default' => '#4cb0c6',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_color_option_hex_sanitize',
'sanitize_js_callback' => 'bikaro_color_escaping_option_sanitize'
));
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'bikaro_primary_color', array(
'label' => __('This will reflect in links, buttons and many others. Choose a color to match your site.', 'bikaro'),
'section' => 'bikaro_primary_color_section',
'settings' => 'bikaro_primary_color'
)));
// Site dark light skin option
$wp_customize->add_section('bikaro_site_skin_section', array(
'priority' => 8,
'title' => __('Color Skin', 'bikaro'),
'panel' => 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_color_skin', array(
'default' => 'light',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control('bikaro_color_skin', array(
'type' => 'radio',
'label' => __('Choose the light or dark skin. This will be reflected in whole site.', 'bikaro'),
'section' => 'bikaro_site_skin_section',
'settings' => 'bikaro_color_skin',
'choices' => array(
'light' => __('Light', 'bikaro'),
'dark' => __('Dark', 'bikaro')
)
));
// Custom CSS setting
$wp_customize->add_section('bikaro_custom_css_section', array(
'priority' => 9,
'title' => __('Custom CSS', 'bikaro'),
'panel' => 'bikaro_design_options'
));
$wp_customize->add_setting('bikaro_custom_css', array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_filter_nohtml_kses',
'sanitize_js_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control('bikaro_custom_css', array(
'type' => 'textarea',
'label' => __('Write your custom CSS code here and design live.', 'bikaro'),
'section' => 'bikaro_custom_css_section',
'settings' => 'bikaro_custom_css'
));
// End of the Design Options
// Start of the Additional Options
$wp_customize->add_panel('bikaro_additional_options', array(
'priority' => 515,
'title' => __('Additional Options', 'bikaro'),
'capability' => 'edit_theme_options',
));
// related posts
$wp_customize->add_section('bikaro_related_posts_section', array(
'priority' => 1,
'title' => __('Related Posts', 'bikaro'),
'panel' => 'bikaro_additional_options'
));
$wp_customize->add_setting('bikaro_related_posts_activate', array(
'default' => 0,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_checkbox_sanitize'
));
$wp_customize->add_control('bikaro_related_posts_activate', array(
'type' => 'checkbox',
'label' => __('Check to activate the related posts.', 'bikaro'),
'section' => 'bikaro_related_posts_section',
'settings' => 'bikaro_related_posts_activate'
));
$wp_customize->add_setting('bikaro_related_posts', array(
'default' => 'categories',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_radio_select_sanitize'
));
$wp_customize->add_control('bikaro_related_posts', array(
'type' => 'radio',
'label' => __('Related Posts To Be Shown As:', 'bikaro'),
'section' => 'bikaro_related_posts_section',
'settings' => 'bikaro_related_posts',
'choices' => array(
'categories' => __('Related Posts By Categories', 'bikaro'),
'tags' => __('Related Posts By Tags', 'bikaro')
)
));
// featured image disable in single post check
$wp_customize->add_section('bikaro_featured_image_disable_section', array(
'priority' => 2,
'title' => __('Remove Featured Image', 'bikaro'),
'panel' => 'bikaro_additional_options'
));
$wp_customize->add_setting('bikaro_featured_image_disable', array(
'default' => 0,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_checkbox_sanitize'
));
$wp_customize->add_control('bikaro_featured_image_disable', array(
'type' => 'checkbox',
'label' => __('Check to disable the featured images in single post.', 'bikaro'),
'section' => 'bikaro_featured_image_disable_section',
'settings' => 'bikaro_featured_image_disable'
));
// author bio enable/disable
$wp_customize->add_section('bikaro_enable_author_bio_section', array(
'priority' => 3,
'title' => __('Author Bio', 'bikaro'),
'panel' => 'bikaro_additional_options'
));
$wp_customize->add_setting('bikaro_enable_author_bio', array(
'default' => 0,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_checkbox_sanitize'
));
$wp_customize->add_control('bikaro_enable_author_bio', array(
'type' => 'checkbox',
'label' => __('Check to enable the Author Bio in single post.', 'bikaro'),
'section' => 'bikaro_enable_author_bio_section',
'settings' => 'bikaro_enable_author_bio'
));
// End of the Additional Options
// Start of the Slider Options
$wp_customize->add_panel('bikaro_slider_options', array(
'priority' => 520,
'title' => __('Slider Options', 'bikaro'),
'capability' => 'edit_theme_options',
));
// slider section
$wp_customize->add_section('bikaro_slider_activate_section', array(
'priority' => 1,
'title' => __('Activate slider', 'bikaro'),
'panel' => 'bikaro_slider_options',
'description' => __('In order to show a slider, you must have the featured image associated with the respective page choosen from below option.', 'bikaro')
));
$wp_customize->add_setting('bikaro_activate_slider', array(
'default' => 0,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_checkbox_sanitize'
));
$wp_customize->add_control('bikaro_activate_slider', array(
'type' => 'checkbox',
'label' => __('Check to activate slider.', 'bikaro'),
'section' => 'bikaro_slider_activate_section',
'settings' => 'bikaro_activate_slider'
));
// slider pages select
for( $i = 1; $i <= 5; $i++ ) {
$wp_customize->add_section('bikaro_slider_image_section'.$i, array(
'title' => __( 'Slider #', 'bikaro' ).$i,
'panel' => 'bikaro_slider_options',
));
$wp_customize->add_setting('bikaro_slider_image'.$i, array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'bikaro_slider_page_sanitize_integer'
));
$wp_customize->add_control('bikaro_slider_image'.$i, array(
'label' => __( 'Slider Page ', 'bikaro' ).$i,
'section' => 'bikaro_slider_image_section'.$i,
'type' => 'dropdown-pages',
));
// slider options settings one
$wp_customize->add_setting('bikaro_slider_first_button_text'.$i, array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control('bikaro_slider_first_button_text'.$i, array(
'label' => __( 'Enter the first button text.', 'bikaro' ),
'description' => ''.__('When this field is empty, Read More button is shown.','bikaro').'',
'section' => 'bikaro_slider_image_section'.$i,
));
$wp_customize->add_setting('bikaro_slider_first_button_link'.$i, array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control('bikaro_slider_first_button_link'.$i, array(
'label' => __( 'Enter link to redirect for the first button.', 'bikaro' ),
'description' => ''.__('When this field is empty, the link will be redirected default to the page link.','bikaro').'',
'section' => 'bikaro_slider_image_section'.$i,
));
// slider options settings two
$wp_customize->add_setting('bikaro_slider_second_button_text'.$i, array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control('bikaro_slider_second_button_text'.$i, array(
'label' => __( 'Enter the second button text.', 'bikaro' ),
'section' => 'bikaro_slider_image_section'.$i,
));
$wp_customize->add_setting('bikaro_slider_second_button_link'.$i, array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control('bikaro_slider_second_button_link'.$i, array(
'label' => __( 'Enter link to redirect for the second button.', 'bikaro' ),
'section' => 'bikaro_slider_image_section'.$i,
));
}
// End of the Slider Options
// Sanitization start
// radio/select buttons sanitization
function bikaro_radio_select_sanitize( $input, $setting ) {
// Ensuring that the input is a slug.
$input = sanitize_key( $input );
// Get the list of choices from the control associated with the setting.
$choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it, else, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
// checkbox sanitize
function bikaro_checkbox_sanitize($input) {
if ( $input == 1 ) {
return 1;
} else {
return '';
}
}
// color sanitization
function bikaro_color_option_hex_sanitize($color) {
if ($unhashed = sanitize_hex_color_no_hash($color))
return '#' . $unhashed;
return $color;
}
function bikaro_color_escaping_option_sanitize($input) {
$input = esc_attr($input);
return $input;
}
// slider pages number sanitization
function bikaro_slider_page_sanitize_integer( $input ) {
if( is_numeric( $input ) ) {
return intval( $input );
}
}
// sanitization of links
function bikaro_links_sanitize() {
return false;
}
}
add_action('customize_register', 'bikaro_customize_register');
?>