/** * Adds theme options to the Customizer screen * * This function is attached to the 'customize_register' action hook. * * @param class $wp_customize * * @since 1.0.0 */ public function customize_register($wp_customize) { $bavotasan_theme_options = bavotasan_theme_options(); // Layout section panel $wp_customize->add_section('bavotasan_layout', array('title' => __('Layout', 'ward'), 'priority' => 35)); $wp_customize->add_setting('ward_theme_options[width]', array('default' => $bavotasan_theme_options['width'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_width', array('label' => __('Site Width', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_theme_options[width]', 'priority' => 10, 'type' => 'select', 'choices' => array('1200' => __('1200px', 'ward'), '992' => __('992px', 'ward')))); $wp_customize->add_setting('ward_theme_options[layout]', array('default' => $bavotasan_theme_options['layout'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_site_layout', array('label' => __('Site Layout', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_theme_options[layout]', 'priority' => 15, 'type' => 'radio', 'choices' => array('1' => __('1 Sidebar - Left', 'ward'), '2' => __('1 Sidebar - Right', 'ward'), '6' => __('No Sidebars', 'ward')))); $choices = array('col-md-2' => '17%', 'col-md-3' => '25%', 'col-md-4' => '34%', 'col-md-5' => '42%', 'col-md-6' => '50%', 'col-md-7' => '58%', 'col-md-8' => '66%', 'col-md-9' => '75%', 'col-md-10' => '83%', 'col-md-12' => '100%'); $wp_customize->add_setting('ward_theme_options[primary]', array('default' => $bavotasan_theme_options['primary'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_primary_column', array('label' => __('Main Content', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_theme_options[primary]', 'priority' => 20, 'type' => 'select', 'choices' => $choices)); $wp_customize->add_setting('ward_theme_options[excerpt_content]', array('default' => $bavotasan_theme_options['excerpt_content'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_excerpt_content', array('label' => __('Post Content Display', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_theme_options[excerpt_content]', 'priority' => 30, 'type' => 'radio', 'choices' => array('excerpt' => __('Teaser Excerpt', 'ward'), 'content' => __('Full Content', 'ward')))); // Jumbo headline section panel $wp_customize->add_section('bavotasan_jumbo', array('title' => __('Jumbo Headline', 'ward'), 'priority' => 36)); $wp_customize->add_setting('ward_theme_options[jumbo_headline_title]', array('default' => $bavotasan_theme_options['jumbo_headline_title'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_title', array('label' => __('Jumbo Headline Title', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_theme_options[jumbo_headline_title]', 'priority' => 26, 'type' => 'text')); $wp_customize->add_setting('ward_theme_options[jumbo_headline_text]', array('default' => $bavotasan_theme_options['jumbo_headline_text'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_text', array('label' => __('Jumbo Headline Text', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_theme_options[jumbo_headline_text]', 'priority' => 27, 'type' => 'text')); // Posts panel $wp_customize->add_section('bavotasan_posts', array('title' => __('Posts', 'ward'), 'priority' => 45)); $wp_customize->add_setting('ward_theme_options[display_categories]', array('default' => $bavotasan_theme_options['display_categories'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_categories', array('label' => __('Display Categories', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_theme_options[display_categories]', 'type' => 'checkbox')); $wp_customize->add_setting('ward_theme_options[display_author]', array('default' => $bavotasan_theme_options['display_author'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_author', array('label' => __('Display Author', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_theme_options[display_author]', 'type' => 'checkbox')); $wp_customize->add_setting('ward_theme_options[display_date]', array('default' => $bavotasan_theme_options['display_date'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_date', array('label' => __('Display Date', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_theme_options[display_date]', 'type' => 'checkbox')); $wp_customize->add_setting('ward_theme_options[display_comment_count]', array('default' => $bavotasan_theme_options['display_comment_count'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_comment_count', array('label' => __('Display Comment Count', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_theme_options[display_comment_count]', 'type' => 'checkbox')); }
/** * Adds theme options to the Customizer screen * * This function is attached to the 'customize_register' action hook. * * @param class $wp_customize * * @since 1.0.0 */ public function customize_register($wp_customize) { $bavotasan_theme_options = bavotasan_theme_options(); $wp_customize->add_setting('tonic_theme_options[tagline]', array('default' => $bavotasan_theme_options['tagline'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_tagline', array('label' => __('Display Tagline', 'tonic'), 'section' => 'title_tagline', 'settings' => 'tonic_theme_options[tagline]', 'type' => 'checkbox')); // Layout section panel $wp_customize->add_section('bavotasan_layout', array('title' => __('Layout', 'tonic'), 'priority' => 35)); $wp_customize->add_setting('tonic_theme_options[width]', array('default' => $bavotasan_theme_options['width'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_width', array('label' => __('Site Width', 'tonic'), 'section' => 'bavotasan_layout', 'settings' => 'tonic_theme_options[width]', 'priority' => 10, 'type' => 'select', 'choices' => array('' => '1200px', 'w960' => __('960px', 'tonic')))); $wp_customize->add_setting('tonic_theme_options[layout]', array('default' => $bavotasan_theme_options['layout'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_site_layout', array('label' => __('Site Layout', 'tonic'), 'section' => 'bavotasan_layout', 'settings' => 'tonic_theme_options[layout]', 'priority' => 15, 'type' => 'radio', 'choices' => array('1' => __('Left Sidebar', 'tonic'), '2' => __('Right Sidebar', 'tonic'), '6' => __('No Sidebar', 'tonic')))); $choices = array('c2' => '17%', 'c3' => '25%', 'c4' => '34%', 'c5' => '42%', 'c6' => '50%', 'c7' => '58%', 'c8' => '66%', 'c9' => '75%', 'c10' => '83%', 'c12' => '100%'); $wp_customize->add_setting('tonic_theme_options[primary]', array('default' => $bavotasan_theme_options['primary'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_primary_column', array('label' => __('Main Content', 'tonic'), 'section' => 'bavotasan_layout', 'settings' => 'tonic_theme_options[primary]', 'priority' => 20, 'type' => 'select', 'choices' => $choices)); $wp_customize->add_setting('tonic_theme_options[excerpt_content]', array('default' => $bavotasan_theme_options['excerpt_content'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_excerpt_content', array('label' => __('Post Content Display', 'tonic'), 'section' => 'bavotasan_layout', 'settings' => 'tonic_theme_options[excerpt_content]', 'priority' => 30, 'type' => 'radio', 'choices' => array('excerpt' => __('Teaser Excerpt', 'tonic'), 'content' => __('Full Content', 'tonic')))); $wp_customize->add_setting('tonic_theme_options[home_widget]', array('default' => $bavotasan_theme_options['home_widget'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_home_widget', array('label' => __('Display Home Page Top Widget Area', 'tonic'), 'section' => 'bavotasan_layout', 'settings' => 'tonic_theme_options[home_widget]', 'priority' => 35, 'type' => 'checkbox')); $wp_customize->add_setting('tonic_theme_options[home_posts]', array('default' => $bavotasan_theme_options['home_posts'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_home_posts', array('label' => __('Display Home Page Posts & Sidebar', 'tonic'), 'section' => 'bavotasan_layout', 'settings' => 'tonic_theme_options[home_posts]', 'priority' => 40, 'type' => 'checkbox')); // Jumbotron $wp_customize->add_section('bavotasan_jumbo', array('title' => __('Jumbo Headline', 'tonic'), 'priority' => 36)); $wp_customize->add_setting('tonic_theme_options[jumbo_headline_title]', array('default' => $bavotasan_theme_options['jumbo_headline_title'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_title', array('label' => __('Title', 'tonic'), 'section' => 'bavotasan_jumbo', 'settings' => 'tonic_theme_options[jumbo_headline_title]', 'priority' => 26, 'type' => 'text')); $wp_customize->add_setting('tonic_theme_options[jumbo_headline_text]', array('default' => $bavotasan_theme_options['jumbo_headline_text'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_text', array('label' => __('Text', 'tonic'), 'section' => 'bavotasan_jumbo', 'settings' => 'tonic_theme_options[jumbo_headline_text]', 'priority' => 27, 'type' => 'text')); $wp_customize->add_setting('tonic_theme_options[jumbo_headline_button_text]', array('default' => $bavotasan_theme_options['jumbo_headline_button_text'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_button_text', array('label' => __('Button Text', 'tonic'), 'section' => 'bavotasan_jumbo', 'settings' => 'tonic_theme_options[jumbo_headline_button_text]', 'priority' => 28, 'type' => 'text')); $wp_customize->add_setting('tonic_theme_options[jumbo_headline_button_link]', array('default' => $bavotasan_theme_options['jumbo_headline_button_link'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_button_link', array('label' => __('Button Link', 'tonic'), 'section' => 'bavotasan_jumbo', 'settings' => 'tonic_theme_options[jumbo_headline_button_link]', 'priority' => 29, 'type' => 'text')); // Posts panel $wp_customize->add_section('bavotasan_posts', array('title' => __('Posts', 'tonic'), 'priority' => 45)); $wp_customize->add_setting('tonic_theme_options[display_categories]', array('default' => $bavotasan_theme_options['display_categories'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_categories', array('label' => __('Display Categories', 'tonic'), 'section' => 'bavotasan_posts', 'settings' => 'tonic_theme_options[display_categories]', 'type' => 'checkbox')); $wp_customize->add_setting('tonic_theme_options[display_author]', array('default' => $bavotasan_theme_options['display_author'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_author', array('label' => __('Display Author', 'tonic'), 'section' => 'bavotasan_posts', 'settings' => 'tonic_theme_options[display_author]', 'type' => 'checkbox')); $wp_customize->add_setting('tonic_theme_options[display_date]', array('default' => $bavotasan_theme_options['display_date'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_date', array('label' => __('Display Date', 'tonic'), 'section' => 'bavotasan_posts', 'settings' => 'tonic_theme_options[display_date]', 'type' => 'checkbox')); $wp_customize->add_setting('tonic_theme_options[display_comment_count]', array('default' => $bavotasan_theme_options['display_comment_count'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_comment_count', array('label' => __('Display Comment Count', 'tonic'), 'section' => 'bavotasan_posts', 'settings' => 'tonic_theme_options[display_comment_count]', 'type' => 'checkbox')); }
<?php /** * The main template file. * * This is the most generic template file in a WordPress theme * and one of the two required files for a theme (the other being style.css). * It is used to display a page when nothing more specific matches a query. * For example, it puts together the home page when no home.php file exists. * * Learn more: http://codex.wordpress.org/Template_Hierarchy * * @since 3.0.0 */ $bavotasan_theme_options = bavotasan_theme_options(); get_header(); if ('page' == get_option('show_on_front')) { include get_page_template(); } else { ?> <div id="primary" <?php bavotasan_primary_attr(); ?> role="main"> <?php $sticky = get_option('sticky_posts'); $featured = new WP_Query(array('posts_per_page' => 1, 'post__in' => $sticky, 'ignore_sticky_posts' => 1)); global $paged; if (!empty($sticky[0]) && 2 > $paged) { ?> <div id="featured" class="row">
/** * Add body class * * @since 1.0.0 */ function bavotasan_body_class($classes) { $bavotasan_theme_options = bavotasan_theme_options(); global $paged; if (is_front_page() && 2 > $paged) { $classes[] = 'only-on-home'; } if (empty($bavotasan_theme_options['fittext'])) { $classes[] = 'no-fittext'; } $classes[] = 'basic'; return $classes; }
/** * Create the required classes for the #secondary sidebar container * * @since 1.0.0 */ function bavotasan_sidebar_class() { $bavotasan_theme_options = bavotasan_theme_options(); $primary = str_replace('col-md-', '', $bavotasan_theme_options['primary']); $class = 'col-md-' . (12 - $primary); echo 'class="' . esc_attr($class) . '"'; }
/** * Create the jumbo headline section on the home page * * @since 1.0.0 */ function bavotasan_jumbotron() { $bavotasan_theme_options = bavotasan_theme_options(); if (!empty($bavotasan_theme_options['jumbo_headline_title'])) { ?> <div class="home-top"> <div class="container"> <div class="row"> <div class="home-jumbotron jumbotron col-lg-10 col-lg-offset-1 col-sm-12"> <h1><?php echo $bavotasan_theme_options['jumbo_headline_title']; ?> </h1> <p class="lead"><?php echo $bavotasan_theme_options['jumbo_headline_text']; ?> </p> <?php if (!empty($bavotasan_theme_options['jumbo_headline_button_text'])) { ?> <a class="btn btn-lg btn-<?php echo $bavotasan_theme_options['jumbo_headline_button_color']; ?> " href="<?php echo $bavotasan_theme_options['jumbo_headline_button_link']; ?> "><?php echo $bavotasan_theme_options['jumbo_headline_button_text']; ?> </a> <?php } ?> <i class="middle-circle fa <?php echo $bavotasan_theme_options['widget_area_icon']; ?> "></i> </div> </div> </div> </div> <?php } }
/** * Set up the article class according to layout selection * * @since 3.0.0 */ function bavotasan_article_class() { global $mb_content_area; $bavotasan_theme_options = bavotasan_theme_options(); $class = 'sidebar' == $mb_content_area ? 'c12 widget-post' : ''; if (is_home() && empty($class)) { global $wp_query; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $grid = $bavotasan_theme_options['grid']; $count = $wp_query->current_post; $class = 'c12'; if ('sidebar' != $mb_content_area) { $class = (2 == $grid || 3 == $grid) && (0 < $count || 1 < $paged) ? 'two-col c6' : $class; $class = 3 == $grid && (2 < $count || 1 < $paged) || 4 == $grid && (0 < $count || 1 < $paged) ? 'three-col c4' : $class; } } return $class; }
/** * Theme options page * * @author c.bavota / Garth Gutenberg <*****@*****.**> * @since 1.0.0 */ public function bavotasan_import_export_page() { // Build export file $export_file = 'theme-options-export.json'; $upload_dir = wp_upload_dir(); $export_file_local = $upload_dir['path'] . '/' . $export_file; $export_file_url = $upload_dir['url'] . '/' . $export_file; if (file_exists($export_file_local)) { unlink($export_file_local); } $export = array('ward_pro_theme_options' => bavotasan_theme_options(), 'ward_custom_css' => get_option('ward_custom_css')); file_put_contents($export_file_local, json_encode($export)); $admin_url = admin_url('themes.php?page=bavotasan_import_export_page'); ?> <div class="wrap" id="custom-background"> <div id="icon-themes" class="icon32"></div> <h2><?php echo get_admin_page_title(); ?> </h2> <?php $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size()); $size = size_format($bytes); if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) { if (!empty($upload_dir['error'])) { ?> <div id="message" class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:', 'ward'); ?> </p> <p><strong><?php echo $upload_dir['error']; ?> </strong></p></div><?php } else { if (!empty($_GET['_wpnonce']) && !wp_verify_nonce($_GET['_wpnonce'], 'import-upload')) { ?> <div id="message" class="error"><p><strong><?php _e('Security issue.', 'ward'); ?> </strong></p></div><?php } elseif (empty($_FILES['import']['name'])) { ?> <div id="message" class="error"><p><strong><?php _e('Please select a file from your desktop.', 'ward'); ?> </strong></p></div><?php } else { $import_json = file_get_contents($_FILES['import']['tmp_name']); $import = json_decode($import_json, true); foreach ($import as $option_name => $option_value) { update_option($option_name, $option_value); } ?> <div id="message" class="updated"><p><strong><?php _e('Import successful.', 'ward'); ?> </strong></p></div><?php } } } ?> <h3><?php _e('Import Theme Options', 'ward'); ?> </h3> <p><?php _e('Choose the JSON file named "theme-options-export.json" to upload your theme options, then click the Upload file and import button below.', 'ward'); ?> </p> <?php wp_import_upload_form($admin_url); ?> <h3><?php _e('Export Theme Options', 'ward'); ?> </h3> <p><?php _e('When you click the button below, WordPress will create a JSON file for you to save to your computer.', 'ward'); ?> </p> <p><?php _e('This format will contain your current theme options and custom CSS.', 'ward'); ?> </p> <p><?php _e('Once you\'ve saved the download file, you can use the Import function in another WordPress installation to import the theme options from this site.', 'ward'); ?> </p> <p class="submit"><a href="<?php echo esc_attr(wp_nonce_url($admin_url . '&file=' . urlencode($export_file_url), 'export')); ?> " class="button-secondary"> <?php _e('Download export file', 'ward'); ?> </a></p> </div> <?php }
/** * Adds theme options to the Customizer screen * * This function is attached to the 'customize_register' action hook. * * @param class $wp_customize * * @since 1.0.0 */ public function customize_register($wp_customize) { $bavotasan_default_theme_options = bavotasan_theme_options(); $wp_customize->add_setting('arc', array('default' => $bavotasan_default_theme_options['arc'], 'sanitize_callback' => 'absint')); $wp_customize->add_control(new Bavotasan_Text_Description_Control($wp_customize, 'arc', array('label' => __('Arc Radius', 'arcade-basic'), 'section' => 'title_tagline', 'priority' => 10))); $wp_customize->add_setting('arc_inner', array('default' => $bavotasan_default_theme_options['arc_inner'], 'sanitize_callback' => 'absint')); $wp_customize->add_control(new Bavotasan_Text_Description_Control($wp_customize, 'arc_inner', array('label' => __('Arc Radius (Inner Pages)', 'arcade-basic'), 'section' => 'title_tagline', 'description' => __('The space and rotation for each letter will be calculated using the arc radius and the width of the site title. Leave blank for no arc.', 'arcade-basic'), 'priority' => 20))); $wp_customize->add_setting('fittext', array('default' => $bavotasan_default_theme_options['fittext'], 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('fittext', array('label' => __('Use Fittext for long site title', 'arcade-basic'), 'section' => 'title_tagline', 'type' => 'checkbox', 'priority' => 30)); $wp_customize->add_setting('header_icon', array('default' => $bavotasan_default_theme_options['header_icon'], 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new Bavotasan_Icon_Select_Control($wp_customize, 'header_icon', array('label' => __('Header Icon', 'arcade-basic'), 'section' => 'title_tagline', 'priority' => 40))); // Layout section panel $wp_customize->add_section('bavotasan_layout', array('title' => __('Layout', 'arcade-basic'), 'priority' => 35)); $wp_customize->add_setting('width', array('default' => $bavotasan_default_theme_options['width'], 'sanitize_callback' => 'absint')); $wp_customize->add_control('width', array('label' => __('Site Width', 'arcade-basic'), 'section' => 'bavotasan_layout', 'priority' => 10, 'type' => 'select', 'choices' => array('1170' => __('1200px', 'arcade-basic'), '992' => __('992px', 'arcade-basic')))); $choices = array('col-md-2' => '17%', 'col-md-3' => '25%', 'col-md-4' => '34%', 'col-md-5' => '42%', 'col-md-6' => '50%', 'col-md-7' => '58%', 'col-md-8' => '66%', 'col-md-9' => '75%', 'col-md-10' => '83%'); $wp_customize->add_setting('primary', array('default' => $bavotasan_default_theme_options['primary'], 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control('primary', array('label' => __('Main Content Width', 'arcade-basic'), 'section' => 'bavotasan_layout', 'priority' => 15, 'type' => 'select', 'choices' => $choices)); $wp_customize->add_setting('layout', array('default' => $bavotasan_default_theme_options['layout'], 'sanitize_callback' => 'esc_attr')); $layout_choices = array('left' => __('Left', 'arcade-basic'), 'right' => __('Right', 'arcade-basic')); $wp_customize->add_control(new Bavotasan_Post_Layout_Control($wp_customize, 'layout', array('label' => __('Sidebar Layout', 'arcade-basic'), 'section' => 'bavotasan_layout', 'size' => false, 'priority' => 25, 'choices' => $layout_choices))); $colors = array('default' => __('Default', 'arcade-basic'), 'info' => __('Light Blue', 'arcade-basic'), 'primary' => __('Blue', 'arcade-basic'), 'danger' => __('Red', 'arcade-basic'), 'warning' => __('Yellow', 'arcade-basic'), 'success' => __('Green', 'arcade-basic')); // Posts panel $wp_customize->add_section('bavotasan_posts', array('title' => __('Posts', 'arcade-basic'), 'priority' => 45, 'description' => __('These options do not affect the Post Block page template.', 'arcade-basic'))); $wp_customize->add_setting('display_author', array('default' => $bavotasan_default_theme_options['display_author'], 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('display_author', array('label' => __('Display Author', 'arcade-basic'), 'section' => 'bavotasan_posts', 'type' => 'checkbox', 'priority' => 10)); $wp_customize->add_setting('display_date', array('default' => $bavotasan_default_theme_options['display_date'], 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('display_date', array('label' => __('Display Date', 'arcade-basic'), 'section' => 'bavotasan_posts', 'type' => 'checkbox', 'priority' => 20)); $wp_customize->add_setting('display_categories', array('default' => $bavotasan_default_theme_options['display_categories'], 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('display_categories', array('label' => __('Display Categories', 'arcade-basic'), 'section' => 'bavotasan_posts', 'type' => 'checkbox', 'priority' => 30)); $wp_customize->add_setting('display_comment_count', array('default' => $bavotasan_default_theme_options['display_comment_count'], 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('display_comment_count', array('label' => __('Display Comment Count', 'arcade-basic'), 'section' => 'bavotasan_posts', 'type' => 'checkbox', 'priority' => 40)); }
/** * Create the required classes for the #tertiary sidebar container * * @since 1.0.0 */ function bavotasan_second_sidebar_class() { $bavotasan_theme_options = bavotasan_theme_options(); $primary = str_replace('col-md-', '', $bavotasan_theme_options['primary']); $secondary = str_replace('col-md-', '', $bavotasan_theme_options['secondary']); $pull = 'left' == $bavotasan_theme_options['layout'] ? ' col-md-pull-' . $primary : ''; $end = 'left' != $bavotasan_theme_options['layout'] ? ' end' : ''; $class = 'col-md-' . (12 - $primary - $secondary) . $end; echo 'class="' . esc_attr($class) . esc_attr($pull) . '"'; }
/** * Create the jumbo headline section on the home page * * @since 1.0.0 */ function bavotasan_jumbotron() { $bavotasan_theme_options = bavotasan_theme_options(); if (!empty($bavotasan_theme_options['jumbo_headline_title'])) { ?> <div class="grid <?php echo $bavotasan_theme_options['width']; ?> row"> <div class="jumbotron c10 s1"> <h1><?php echo $bavotasan_theme_options['jumbo_headline_title']; ?> </h1> <p class="lead"><?php echo $bavotasan_theme_options['jumbo_headline_text']; ?> </p> <?php if (!empty($bavotasan_theme_options['jumbo_headline_button_text'])) { ?> <a class="btn btn-large btn-primary" href="<?php echo $bavotasan_theme_options['jumbo_headline_button_link']; ?> "><?php echo $bavotasan_theme_options['jumbo_headline_button_text']; ?> </a> <?php } ?> </div> </div> <?php } }
/** * Create the required classes for the #secondary sidebar container * * @since 1.0.0 */ function bavotasan_sidebar_class() { $bavotasan_theme_options = bavotasan_theme_options(); $primary = str_replace('col-md-', '', $bavotasan_theme_options['primary']); $end = 'right' == $bavotasan_theme_options['layout'] ? ' end' : ''; $class = 'col-md-' . (12 - $primary) . $end; echo 'class="' . esc_attr($class) . '"'; }
/** * Adds theme options to the Customizer screen * * This function is attached to the 'customize_register' action hook. * * @param class $wp_customize * * @since 1.0.0 */ public function customize_register($wp_customize) { $bavotasan_theme_options = bavotasan_theme_options(); // Layout section panel $wp_customize->add_section('bavotasan_layout', array('title' => __('Layout', 'ward'), 'priority' => 35)); $wp_customize->add_setting('ward_pro_theme_options[boxed]', array('default' => $bavotasan_theme_options['boxed'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_boxed', array('label' => __('Boxed', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[boxed]', 'type' => 'checkbox', 'priority' => 5)); $wp_customize->add_setting('ward_pro_theme_options[width]', array('default' => $bavotasan_theme_options['width'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_width', array('label' => __('Site Width', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[width]', 'priority' => 10, 'type' => 'select', 'choices' => array('1200' => __('1200px', 'ward'), '992' => __('992px', 'ward')))); $choices = array('col-md-2' => '17%', 'col-md-3' => '25%', 'col-md-4' => '34%', 'col-md-5' => '42%', 'col-md-6' => '50%', 'col-md-7' => '58%', 'col-md-8' => '66%', 'col-md-9' => '75%', 'col-md-10' => '83%'); $wp_customize->add_setting('ward_pro_theme_options[primary]', array('default' => $bavotasan_theme_options['primary'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_primary_column', array('label' => __('Main Content', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[primary]', 'priority' => 15, 'type' => 'select', 'choices' => $choices)); if (is_active_sidebar('second-sidebar')) { $wp_customize->add_setting('ward_pro_theme_options[secondary]', array('default' => $bavotasan_theme_options['secondary'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_secondary_column', array('label' => __('First Sidebar', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[secondary]', 'priority' => 20, 'type' => 'select', 'choices' => $choices)); } $wp_customize->add_setting('ward_pro_theme_options[layout]', array('default' => $bavotasan_theme_options['layout'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $layout_choices = array('left' => __('Left', 'ward'), 'right' => __('Right', 'ward')); if (is_active_sidebar('second-sidebar')) { $layout_choices['separate'] = __('Separate', 'ward'); } $wp_customize->add_control(new Bavotasan_Post_Layout_Control($wp_customize, 'layout', array('label' => __('Sidebar Layout', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[layout]', 'size' => false, 'priority' => 25, 'choices' => $layout_choices))); $wp_customize->add_setting('ward_pro_theme_options[excerpt_content]', array('default' => $bavotasan_theme_options['excerpt_content'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_excerpt_content', array('label' => __('Post Content Display', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[excerpt_content]', 'priority' => 30, 'type' => 'radio', 'choices' => array('excerpt' => __('Teaser Excerpt', 'ward'), 'content' => __('Full Content', 'ward')))); $wp_customize->add_setting('ward_pro_theme_options[read_more]', array('default' => $bavotasan_theme_options['read_more'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_read_more', array('label' => __('"Read More" Text', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[read_more]', 'priority' => 33, 'type' => 'text')); $colors = array('info' => __('Light Blue', 'ward'), 'primary' => __('Blue', 'ward'), 'danger' => __('Red', 'ward'), 'warning' => __('Yellow', 'ward'), 'success' => __('Green', 'ward')); $wp_customize->add_setting('ward_pro_theme_options[read_more_color]', array('default' => $bavotasan_theme_options['read_more_color'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_read_more_color', array('label' => __('Read More Color', 'ward'), 'section' => 'bavotasan_layout', 'settings' => 'ward_pro_theme_options[read_more_color]', 'priority' => 34, 'type' => 'select', 'choices' => $colors)); // Jumbo headline section panel $wp_customize->add_section('bavotasan_jumbo', array('title' => __('Jumbo Headline', 'ward'), 'priority' => 36)); $wp_customize->add_setting('ward_pro_theme_options[jumbo_headline_title]', array('default' => $bavotasan_theme_options['jumbo_headline_title'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_title', array('label' => __('Title', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_pro_theme_options[jumbo_headline_title]', 'priority' => 26, 'type' => 'text')); $wp_customize->add_setting('ward_pro_theme_options[jumbo_headline_text]', array('default' => $bavotasan_theme_options['jumbo_headline_text'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_text', array('label' => __('Text', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_pro_theme_options[jumbo_headline_text]', 'priority' => 27, 'type' => 'text')); $wp_customize->add_setting('ward_pro_theme_options[jumbo_headline_button_text]', array('default' => $bavotasan_theme_options['jumbo_headline_button_text'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_button_text', array('label' => __('Button Text', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_pro_theme_options[jumbo_headline_button_text]', 'priority' => 28, 'type' => 'text')); $wp_customize->add_setting('ward_pro_theme_options[jumbo_headline_button_link]', array('default' => $bavotasan_theme_options['jumbo_headline_button_link'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_button_link', array('label' => __('Button Link', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_pro_theme_options[jumbo_headline_button_link]', 'priority' => 29, 'type' => 'text')); $wp_customize->add_setting('ward_pro_theme_options[jumbo_headline_button_color]', array('default' => $bavotasan_theme_options['jumbo_headline_button_color'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_jumbo_headline_button_color', array('label' => __('Button Color', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_pro_theme_options[jumbo_headline_button_color]', 'priority' => 30, 'type' => 'select', 'choices' => $colors)); $wp_customize->add_setting('ward_pro_theme_options[widget_area_icon]', array('default' => $bavotasan_theme_options['widget_area_icon'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new Bavotasan_Icon_Select_Control($wp_customize, 'widget_area_icon', array('label' => __('Icon', 'ward'), 'section' => 'bavotasan_jumbo', 'settings' => 'ward_pro_theme_options[widget_area_icon]', 'priority' => 35))); // Fonts panel $mixed_fonts = array_merge(bavotasan_websafe_fonts(), bavotasan_google_fonts()); asort($mixed_fonts); $wp_customize->add_section('bavotasan_fonts', array('title' => __('Fonts', 'ward'), 'priority' => 40)); $wp_customize->add_setting('ward_pro_theme_options[main_text_font]', array('default' => $bavotasan_theme_options['main_text_font'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_main_text_font', array('label' => __('Main Text', 'ward'), 'section' => 'bavotasan_fonts', 'settings' => 'ward_pro_theme_options[main_text_font]', 'priority' => 10, 'type' => 'select', 'choices' => $mixed_fonts)); $wp_customize->add_setting('ward_pro_theme_options[headers_font]', array('default' => $bavotasan_theme_options['headers_font'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_headers_font', array('label' => __('Headers (h1, h2, h3, etc...)', 'ward'), 'section' => 'bavotasan_fonts', 'settings' => 'ward_pro_theme_options[headers_font]', 'priority' => 15, 'type' => 'select', 'choices' => $mixed_fonts)); $wp_customize->add_setting('ward_pro_theme_options[post_title_font]', array('default' => $bavotasan_theme_options['post_title_font'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_post_title_font', array('label' => __('Post Title', 'ward'), 'section' => 'bavotasan_fonts', 'settings' => 'ward_pro_theme_options[post_title_font]', 'priority' => 30, 'type' => 'select', 'choices' => $mixed_fonts)); $wp_customize->add_setting('ward_pro_theme_options[post_meta_font]', array('default' => $bavotasan_theme_options['post_meta_font'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_meta_font', array('label' => __('Post Meta', 'ward'), 'section' => 'bavotasan_fonts', 'settings' => 'ward_pro_theme_options[post_meta_font]', 'priority' => 35, 'type' => 'select', 'choices' => $mixed_fonts)); $wp_customize->add_setting('ward_pro_theme_options[post_category_font]', array('default' => $bavotasan_theme_options['post_category_font'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_post_category_font', array('label' => __('Post Category', 'ward'), 'section' => 'bavotasan_fonts', 'settings' => 'ward_pro_theme_options[post_category_font]', 'priority' => 40, 'type' => 'select', 'choices' => $mixed_fonts)); // Color panel $wp_customize->add_setting('ward_pro_theme_options[headers_color]', array('default' => $bavotasan_theme_options['headers_color'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'headers_color', array('label' => __('Headers (h1, h2, h3, etc...)', 'ward'), 'section' => 'colors', 'settings' => 'ward_pro_theme_options[headers_color]', 'priority' => 20))); $wp_customize->add_setting('ward_pro_theme_options[main_text_color]', array('default' => $bavotasan_theme_options['main_text_color'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'main_text_color', array('label' => __('Main Text Color', 'ward'), 'section' => 'colors', 'settings' => 'ward_pro_theme_options[main_text_color]', 'priority' => 25))); $wp_customize->add_setting('ward_pro_theme_options[link_color]', array('default' => $bavotasan_theme_options['link_color'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Link Color', 'ward'), 'section' => 'colors', 'settings' => 'ward_pro_theme_options[link_color]', 'priority' => 50))); $wp_customize->add_setting('ward_pro_theme_options[link_hover_color]', array('default' => $bavotasan_theme_options['link_hover_color'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_hover_color', array('label' => __('Link Hover Color', 'ward'), 'section' => 'colors', 'settings' => 'ward_pro_theme_options[link_hover_color]', 'priority' => 55))); $wp_customize->add_setting('ward_pro_theme_options[widget_area_color]', array('default' => $bavotasan_theme_options['widget_area_color'], 'type' => 'option', 'sanitize_callback' => 'sanitize_hex_color', 'capability' => 'edit_theme_options')); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'widget_area_color', array('label' => __('Widget Area Background Color', 'ward'), 'section' => 'colors', 'settings' => 'ward_pro_theme_options[widget_area_color]', 'priority' => 56))); // Nav panel $wp_customize->add_setting('ward_pro_theme_options[nav_palette]', array('default' => $bavotasan_theme_options['nav_palette'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_nav_palette', array('label' => __('Nav Color', 'ward'), 'section' => 'nav', 'settings' => 'ward_pro_theme_options[nav_palette]', 'priority' => 40, 'type' => 'select', 'choices' => array('navbar-default' => __('Light', 'ward'), 'navbar-inverse' => __('Dark', 'ward')))); // Posts panel $wp_customize->add_section('bavotasan_posts', array('title' => __('Posts', 'ward'), 'priority' => 45)); $wp_customize->add_setting('ward_pro_theme_options[display_categories]', array('default' => $bavotasan_theme_options['display_categories'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_categories', array('label' => __('Display Categories', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_pro_theme_options[display_categories]', 'type' => 'checkbox')); $wp_customize->add_setting('ward_pro_theme_options[display_author]', array('default' => $bavotasan_theme_options['display_author'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_author', array('label' => __('Display Author', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_pro_theme_options[display_author]', 'type' => 'checkbox')); $wp_customize->add_setting('ward_pro_theme_options[display_date]', array('default' => $bavotasan_theme_options['display_date'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_date', array('label' => __('Display Date', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_pro_theme_options[display_date]', 'type' => 'checkbox')); $wp_customize->add_setting('ward_pro_theme_options[display_comment_count]', array('default' => $bavotasan_theme_options['display_comment_count'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_display_comment_count', array('label' => __('Display Comment Count', 'ward'), 'section' => 'bavotasan_posts', 'settings' => 'ward_pro_theme_options[display_comment_count]', 'type' => 'checkbox')); // Footer panel $wp_customize->add_section('bavotasan_footer', array('title' => __('Footer', 'ward'), 'priority' => 50)); $wp_customize->add_setting('ward_pro_theme_options[extended_footer_columns]', array('default' => $bavotasan_theme_options['extended_footer_columns'], 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'postMessage')); $wp_customize->add_control('bavotasan_extended_footer_columns', array('label' => __('Extended Footer Columns', 'ward'), 'section' => 'bavotasan_footer', 'settings' => 'ward_pro_theme_options[extended_footer_columns]', 'priority' => 10, 'type' => 'select', 'choices' => array('col-md-12' => __('1 Column', 'ward'), 'col-md-6' => __('2 Columns', 'ward'), 'col-md-4' => __('3 Columns', 'ward'), 'col-md-3' => __('4 Columns', 'ward'), 'col-md-2' => __('6 Columns', 'ward')))); $wp_customize->add_setting('ward_pro_theme_options[copyright]', array('default' => $bavotasan_theme_options['copyright'], 'type' => 'option', 'capability' => 'edit_theme_options')); $wp_customize->add_control('bavotasan_copyright', array('label' => __('Copyright Notice', 'ward'), 'section' => 'bavotasan_footer', 'settings' => 'ward_pro_theme_options[copyright]', 'priority' => 20)); }
/** * Adds theme options to the Customizer screen * * This function is attached to the 'customize_register' action hook. * * @param class $wp_customize * * @since 1.0.0 */ public function customize_register($wp_customize) { $bavotasan_theme_options = bavotasan_theme_options(); $wp_customize->add_setting('arcade_basic_theme_options[arc]', array('default' => $bavotasan_theme_options['arc'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control(new Bavotasan_Text_Description_Control($wp_customize, 'arc', array('label' => __('Arc Radius', 'arcade'), 'section' => 'title_tagline', 'settings' => 'arcade_basic_theme_options[arc]', 'description' => __('The space and rotation for each letter will be calculated using the arc radius and the width of the site title. Leave blank for no arc.', 'arcade')))); $wp_customize->add_setting('arcade_basic_theme_options[fittext]', array('default' => $bavotasan_theme_options['fittext'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_fittext', array('label' => __('Use Fittext for long site title', 'arcade'), 'section' => 'title_tagline', 'settings' => 'arcade_basic_theme_options[fittext]', 'type' => 'checkbox')); $wp_customize->add_setting('arcade_basic_theme_options[header_icon]', array('default' => $bavotasan_theme_options['header_icon'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control(new Bavotasan_Icon_Select_Control($wp_customize, 'header_icon', array('label' => __('Header Icon', 'arcade'), 'section' => 'title_tagline', 'settings' => 'arcade_basic_theme_options[header_icon]'))); // Layout section panel $wp_customize->add_section('bavotasan_layout', array('title' => __('Layout', 'arcade'), 'priority' => 35)); $wp_customize->add_setting('arcade_basic_theme_options[width]', array('default' => $bavotasan_theme_options['width'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control('bavotasan_width', array('label' => __('Site Width', 'arcade'), 'section' => 'bavotasan_layout', 'settings' => 'arcade_basic_theme_options[width]', 'priority' => 10, 'type' => 'select', 'choices' => array('1170' => __('1200px', 'arcade'), '992' => __('992px', 'arcade')))); $choices = array('col-md-2' => '17%', 'col-md-3' => '25%', 'col-md-4' => '34%', 'col-md-5' => '42%', 'col-md-6' => '50%', 'col-md-7' => '58%', 'col-md-8' => '66%', 'col-md-9' => '75%', 'col-md-10' => '83%', 'col-md-12' => '100%'); $wp_customize->add_setting('arcade_basic_theme_options[primary]', array('default' => $bavotasan_theme_options['primary'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control('bavotasan_primary_column', array('label' => __('Main Content Width', 'arcade'), 'section' => 'bavotasan_layout', 'settings' => 'arcade_basic_theme_options[primary]', 'priority' => 15, 'type' => 'select', 'choices' => $choices)); $wp_customize->add_setting('arcade_basic_theme_options[layout]', array('default' => $bavotasan_theme_options['layout'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $layout_choices = array('left' => __('Left', 'arcade'), 'right' => __('Right', 'arcade')); $wp_customize->add_control(new Bavotasan_Post_Layout_Control($wp_customize, 'layout', array('label' => __('Sidebar Layout', 'arcade'), 'section' => 'bavotasan_layout', 'settings' => 'arcade_basic_theme_options[layout]', 'size' => false, 'priority' => 25, 'choices' => $layout_choices))); $colors = array('default' => __('Default', 'arcade'), 'info' => __('Light Blue', 'arcade'), 'primary' => __('Blue', 'arcade'), 'danger' => __('Red', 'arcade'), 'warning' => __('Yellow', 'arcade'), 'success' => __('Green', 'arcade')); // Jumbo headline section panel $wp_customize->add_section('bavotasan_jumbo', array('title' => __('Jumbo Headline', 'arcade'), 'priority' => 36, 'description' => __('This section appears below the header image on the home page. To remove it just delete all the content from the Title textarea.', 'arcade'))); $wp_customize->add_setting('arcade_basic_theme_options[jumbo_headline_title]', array('default' => $bavotasan_theme_options['jumbo_headline_title'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_textarea')); $wp_customize->add_control(new Bavotasan_Textarea_Control($wp_customize, 'jumbo_headline_title', array('label' => __('Title', 'arcade'), 'section' => 'bavotasan_jumbo', 'settings' => 'arcade_basic_theme_options[jumbo_headline_title]', 'priority' => 26, 'type' => 'text'))); $wp_customize->add_setting('arcade_basic_theme_options[jumbo_headline_text]', array('default' => $bavotasan_theme_options['jumbo_headline_text'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_textarea')); $wp_customize->add_control(new Bavotasan_Textarea_Control($wp_customize, 'jumbo_headline_text', array('label' => __('Text', 'arcade'), 'section' => 'bavotasan_jumbo', 'settings' => 'arcade_basic_theme_options[jumbo_headline_text]', 'priority' => 27, 'type' => 'text'))); // Posts panel $wp_customize->add_section('bavotasan_posts', array('title' => __('Posts', 'arcade'), 'priority' => 45, 'description' => __('These options do not affect the home page post section.', 'arcade'))); $wp_customize->add_setting('arcade_basic_theme_options[display_categories]', array('default' => $bavotasan_theme_options['display_categories'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_categories', array('label' => __('Display Categories', 'arcade'), 'section' => 'bavotasan_posts', 'settings' => 'arcade_basic_theme_options[display_categories]', 'type' => 'checkbox')); $wp_customize->add_setting('arcade_basic_theme_options[display_author]', array('default' => $bavotasan_theme_options['display_author'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_author', array('label' => __('Display Author', 'arcade'), 'section' => 'bavotasan_posts', 'settings' => 'arcade_basic_theme_options[display_author]', 'type' => 'checkbox')); $wp_customize->add_setting('arcade_basic_theme_options[display_date]', array('default' => $bavotasan_theme_options['display_date'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_date', array('label' => __('Display Date', 'arcade'), 'section' => 'bavotasan_posts', 'settings' => 'arcade_basic_theme_options[display_date]', 'type' => 'checkbox')); $wp_customize->add_setting('arcade_basic_theme_options[display_comment_count]', array('default' => $bavotasan_theme_options['display_comment_count'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_comment_count', array('label' => __('Display Comment Count', 'arcade'), 'section' => 'bavotasan_posts', 'settings' => 'arcade_basic_theme_options[display_comment_count]', 'type' => 'checkbox')); }
/** * Adds theme options to the Customizer screen * * This function is attached to the 'customize_register' action hook. * * @param class $wp_customize * * @since 1.0.0 */ public function customize_register($wp_customize) { $bavotasan_theme_options = bavotasan_theme_options(); // Layout section panel $wp_customize->add_section('bavotasan_layout', array('title' => __('Layout', 'matheson'), 'priority' => 35)); $wp_customize->add_setting('matheson_theme_options[width]', array('default' => $bavotasan_theme_options['width'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint')); $wp_customize->add_control('bavotasan_width', array('label' => __('Site Width', 'matheson'), 'section' => 'bavotasan_layout', 'settings' => 'matheson_theme_options[width]', 'priority' => 10, 'type' => 'select', 'choices' => array('1200' => __('1200px', 'matheson'), '992' => __('992px', 'matheson')))); $choices = array('col-md-2' => '17%', 'col-md-3' => '25%', 'col-md-4' => '34%', 'col-md-5' => '42%', 'col-md-6' => '50%', 'col-md-7' => '58%', 'col-md-8' => '66%', 'col-md-9' => '75%', 'col-md-10' => '83%', 'col-md-12' => '100%'); $wp_customize->add_setting('matheson_theme_options[primary]', array('default' => $bavotasan_theme_options['primary'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control('bavotasan_primary_column', array('label' => __('Main Content Width', 'matheson'), 'section' => 'bavotasan_layout', 'settings' => 'matheson_theme_options[primary]', 'priority' => 15, 'type' => 'select', 'choices' => $choices)); $wp_customize->add_setting('matheson_theme_options[layout]', array('default' => $bavotasan_theme_options['layout'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $layout_choices = array('left' => __('Left', 'matheson'), 'right' => __('Right', 'matheson')); $wp_customize->add_control(new Bavotasan_Post_Layout_Control($wp_customize, 'layout', array('label' => __('Sidebar Layout', 'matheson'), 'section' => 'bavotasan_layout', 'settings' => 'matheson_theme_options[layout]', 'size' => false, 'priority' => 25, 'choices' => $layout_choices))); $wp_customize->add_setting('matheson_theme_options[excerpt_content]', array('default' => $bavotasan_theme_options['excerpt_content'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr')); $wp_customize->add_control('bavotasan_excerpt_content', array('label' => __('Post Content Display', 'matheson'), 'section' => 'bavotasan_layout', 'settings' => 'matheson_theme_options[excerpt_content]', 'priority' => 30, 'type' => 'radio', 'choices' => array('excerpt' => __('Teaser Excerpt', 'matheson'), 'content' => __('Full Content', 'matheson')))); // Jumbo headline section panel $wp_customize->add_section('bavotasan_jumbo', array('title' => __('Jumbo Headline', 'matheson'), 'priority' => 36, 'description' => __('This section appears below the slider/header image on the home page. To remove it just delete all the content from the Title textarea.', 'matheson'))); $wp_customize->add_setting('matheson_theme_options[jumbo_headline_title]', array('default' => $bavotasan_theme_options['jumbo_headline_title'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_textarea')); $wp_customize->add_control(new Bavotasan_Textarea_Control($wp_customize, 'jumbo_headline_title', array('label' => __('Title', 'matheson'), 'section' => 'bavotasan_jumbo', 'settings' => 'matheson_theme_options[jumbo_headline_title]', 'priority' => 26, 'type' => 'text'))); $wp_customize->add_setting('matheson_theme_options[jumbo_headline_text]', array('default' => $bavotasan_theme_options['jumbo_headline_text'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_textarea')); $wp_customize->add_control(new Bavotasan_Textarea_Control($wp_customize, 'jumbo_headline_text', array('label' => __('Text', 'matheson'), 'section' => 'bavotasan_jumbo', 'settings' => 'matheson_theme_options[jumbo_headline_text]', 'priority' => 27, 'type' => 'text'))); // Posts panel $wp_customize->add_section('bavotasan_posts', array('title' => __('Posts', 'matheson'), 'priority' => 45)); $wp_customize->add_setting('matheson_theme_options[display_categories]', array('default' => $bavotasan_theme_options['display_categories'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_categories', array('label' => __('Display Categories', 'matheson'), 'section' => 'bavotasan_posts', 'settings' => 'matheson_theme_options[display_categories]', 'type' => 'checkbox')); $wp_customize->add_setting('matheson_theme_options[display_author]', array('default' => $bavotasan_theme_options['display_author'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_author', array('label' => __('Display Author', 'matheson'), 'section' => 'bavotasan_posts', 'settings' => 'matheson_theme_options[display_author]', 'type' => 'checkbox')); $wp_customize->add_setting('matheson_theme_options[display_date]', array('default' => $bavotasan_theme_options['display_date'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_date', array('label' => __('Display Date', 'matheson'), 'section' => 'bavotasan_posts', 'settings' => 'matheson_theme_options[display_date]', 'type' => 'checkbox')); $wp_customize->add_setting('matheson_theme_options[display_comment_count]', array('default' => $bavotasan_theme_options['display_comment_count'], 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => array($this, 'sanitize_checkbox'))); $wp_customize->add_control('bavotasan_display_comment_count', array('label' => __('Display Comment Count', 'matheson'), 'section' => 'bavotasan_posts', 'settings' => 'matheson_theme_options[display_comment_count]', 'type' => 'checkbox')); }
/** * Create the required classes for the #secondary sidebar container * * @since 1.0.0 */ function bavotasan_sidebar_class() { $bavotasan_theme_options = bavotasan_theme_options(); $primary = str_replace('col-md-', '', $bavotasan_theme_options['primary']); $pull = ''; if (is_active_sidebar('second-sidebar')) { $class = $bavotasan_theme_options['secondary']; $pull = 'right' != $bavotasan_theme_options['layout'] ? ' col-md-pull-' . $primary : ''; } else { $end = 'right' == $bavotasan_theme_options['layout'] ? ' end' : ''; $class = 'col-md-' . (12 - $primary) . $end; } echo 'class="' . esc_attr($class) . esc_attr($pull) . '"'; }