'#40c2a6',
'accent_font' => '#ffffff',
'box_background' => '#ffffff',
'site_background' => '#ffffff',
// 'font_size' => '14px',
// 'font_face' => '"Lato", sans-serif',
// 'font_style' => 'none',
// 'font_color' => '#444444',
) ) );
// Directory path for radioimage buttons
$imagepath = trailingslashit( HOOT_THEMEURI ) . 'admin/images/';
// Logo Sizes (different range than standard typography range)
$logosizes = array();
$logosizerange = range( 14, 110 );
foreach ( $logosizerange as $isr )
$logosizes[ $isr . 'px' ] = $isr . 'px';
$logosizes = apply_filters( 'hoot_theme_options_logosizes', $logosizes);
/*** Add Options (Panels, Sections, Settings) ***/
/** Panel Genral **/
$panel = 'general';
$panels[ $panel ] = array(
'title' => __( 'Setup & Layout', 'chromatic' ),
'icon' => 'dashicons dashicons-admin-settings', // fa fa-sliders
);
$section = 'setup';
$sections[ $section ] = array(
'title' => __( 'Site Setup', 'chromatic' ),
'panel' => $panel,
// 'description' => __( '', 'chromatic' ),
);
$settings['site_layout'] = array(
'label' => __( 'Site Layout - Boxed vs Stretched', 'chromatic' ),
'section' => $section,
'type' => 'radio',
'choices' => array(
'boxed' => __('Boxed layout', 'chromatic'),
'stretch' => __('Stretched layout (full width)', 'chromatic'),
),
'default' => 'stretch',
'description' => array(
'type' => 'blue',
'text' => __("For boxed layouts, both backgrounds (site and content box) can be set in the 'Styling > Backgrounds' panel.
For Stretched Layout, only site background is available.", 'chromatic'),
),
);
$settings['site_width'] = array(
'label' => __( 'Max. Site Width (pixels)', 'chromatic' ),
'section' => $section,
'type' => 'radio',
'choices' => array(
'1260' => __('1260px (wide)', 'chromatic'),
'1080' => __('1080px (standard)', 'chromatic'),
),
'default' => '1260',
);
$settings['load_minified'] = array(
'label' => __( 'Load Minified Styles and Scripts (when available)', 'chromatic' ),
'sublabel' => __( 'Checking this option reduces data size, hence increasing page load speed.', 'chromatic' ),
'section' => $section,
'type' => 'checkbox',
'priority' => '25', // Non static options must have a priority
);
$section = 'logo';
$sections[ $section ] = array(
'title' => __( 'Logo Settings', 'chromatic' ),
'panel' => $panel,
// 'description' => __( '', 'chromatic' ),
);
$settings['logo'] = array(
'label' => __( 'Site Logo', 'chromatic' ),
'section' => $section,
'type' => 'radio',
'choices' => array(
'text' => __('Default Text (Site Title)', 'chromatic'),
'image' => __('Image Logo', 'chromatic'),
'mixed' => __('Image & Default Text (Site Title)', 'chromatic'),
),
'default' => 'text',
'description' => array(
'type' => 'blue',
'text' => sprintf( __('Use %sSite Title%s as default text logo', 'chromatic'), '', '' ),
),
);
$settings['logo_size'] = array(
'label' => __( 'Logo Size', 'chromatic' ),
'section' => $section,
'type' => 'select',
'priority' => '35', // Non static options must have a priority
'choices' => array(
'tiny' => __( 'Tiny', 'chromatic'),
'small' => __( 'Small', 'chromatic'),
'medium' => __( 'Medium', 'chromatic'),
'large' => __( 'Large', 'chromatic'),
'huge' => __( 'Huge', 'chromatic'),
),
'default' => 'medium',
'active_callback' => 'hoot_callback_logo_size',
);
$settings['site_title_icon'] = array(
'label' => __( 'Site Title Icon (Optional)', 'chromatic' ),
'section' => $section,
'type' => 'icon',
// 'default' => 'fa-anchor',
'description' => __( 'Leave empty to hide icon.', 'chromatic' ),
'active_callback' => 'hoot_callback_site_title_icon',
);
$settings['site_title_icon_size'] = array(
'label' => __( 'Site Title Icon Size', 'chromatic' ),
'section' => $section,
'type' => 'select',
'choices' => $logosizes,
'default' => '45px',
'active_callback' => 'hoot_callback_site_title_icon',
);
if ( ! function_exists( 'the_custom_logo' ) )
$settings['logo_image'] = array(
'label' => __( 'Upload Logo', 'chromatic' ),
'section' => $section,
'type' => 'image',
'priority' => '45', // Replaced by WP's custom_logo if available // Update in premium if needed
'active_callback' => 'hoot_callback_logo_image',
);
$settings['logo_image_width'] = array(
'label' => __( 'Maximum Logo Width', 'chromatic' ),
'section' => $section,
'type' => 'text',
'priority' => '46', // Keep it with image logo // Update in premium if needed
'default' => 200,
'description' => __( '(in pixels)
<!--default-->
tag to show the default Info Text.<!--year-->
tag to insert the current year.©
', 'chromatic'), '', '' ),
),
);
/** Panel Styling **/
$panel = 'styling';
$panels[ $panel ] = array(
'title' => __( 'Styling', 'chromatic' ),
'icon' => 'dashicons dashicons-art', // fa fa-align-center
);
$section = 'colors';
// Redundant as 'colors' section is added by WP. But we still add it for brevity
$sections[ $section ] = array(
'title' => __( 'Colors', 'chromatic' ),
'panel' => $panel,
'description' => __('Control various color options in the premium version for fonts, backgrounds, contrast, highlight, accent etc.', 'chromatic'),
);
$settings['accent_color'] = array(
'label' => __( 'Accent Color', 'chromatic' ),
'section' => $section,
'type' => 'color',
'default' => $accent_color,
);
$settings['accent_font'] = array(
'label' => __( 'Font Color on Accent Color', 'chromatic' ),
'section' => $section,
'type' => 'color',
'default' => $accent_font,
);
if ( current_theme_supports( 'woocommerce' ) && !function_exists( 'woocommerce_boxcontent_shop' ) ) :
$settings['woocommerce-colors-plugin'] = array(
'label' => __( 'Woocommerce Styling', 'chromatic' ),
'section' => $section,
'type' => 'content',
'priority' => '225', // Non static options must have a priority
'content' => sprintf( __('Looks like you are using Woocommerce. Install %sthis plugin%s to change colors and styles for WooCommerce elements like buttons etc.', 'chromatic'), '', '' ),
);
endif;
$section = 'backgrounds';
$sections[ $section ] = array(
'title' => __( 'Backgrounds', 'chromatic' ),
'panel' => $panel,
'description' => __('The premium version comes with background options for different sections of your site like header, menu dropdown, content area, logo background, footer etc.', 'chromatic'),
);
$settings['background'] = array(
'label' => __( 'Site Background', 'chromatic' ),
'section' => $section,
'type' => 'betterbackground',
'default' => array(
'color' => $site_background,
// 'pattern' => 'hoot/images/patterns/7.png',
),
);
$settings['box_background'] = array(
'label' => __( 'Content Box Background', 'chromatic' ),
'section' => $section,
'type' => 'betterbackground',
'default' => array(
'color' => $box_background,
// 'pattern' => 'hoot/images/patterns/7.png',
),
'description' => array(
'type' => 'blue',
'text' => __("This background is available only when 'Boxed' option is selected in the 'Setup & Layout > Site Setup' panel.", 'chromatic'),
),
// 'active_callback' => 'hoot_callback_box_background_color',
);
/** Panel Content **/
$panel = 'content';
$panels[ $panel ] = array(
'title' => __( 'Content', 'chromatic' ),
'icon' => 'dashicons dashicons-editor-alignleft', // fa fa-align-center
);
$section = 'topbar';
$sections[ $section ] = array(
'title' => __( 'Topbar', 'chromatic' ),
'panel' => $panel,
// 'description' => __( '', 'chromatic' ),
);
$settings['topbar-widget-areas'] = array(
'label' => __( 'Left/Right Topbar', 'chromatic' ),
'section' => $section,
'type' => 'content',
'content' => sprintf( __('You can add content to Left/Right Topbar using Text Widget in the %sWidget Management Screen%s', 'chromatic'), '', '' ),
);
if ( current_theme_supports( 'hoot-widgetized-template' ) ) :
// $panel = 'templates';
// global $wp_version;
// $panels[ $panel ] = array(
// 'title' => __( 'Templates', 'chromatic' ),
// 'icon' => ( ( version_compare( $wp_version, '4.3', '>=' ) ) ? 'dashicons dashicons-editor-table' : 'dashicons dashicons-grid-view' ),
// );
$section = 'widgetized-template';
$sections[ $section ] = array(
'title' => __( 'Widgetized Template - Modules', 'chromatic' ),
'panel' => $panel,
'description' => sprintf( __( "How to use this template'Widgetized Template' is a special Page Template which is often used as a quick way to create a Front Page.
Sort different sections of the 'Widgetized Template' in the order you want them to appear.
This is a sample description text for the slide.
', 'chromatic'), 'description' => array( 'type' => 'yellow', 'text' => __('You can use the<h3>Lorem Ipsum Dolor</h3>
tag to create styled heading.', 'chromatic'),
),
),
'button' => array(
'label' => __( 'Button Text', 'chromatic' ),
'type' => 'text',
),
'url' => array(
'label' => __( 'Button URL', 'chromatic' ),
'type' => 'url',
'description' => __( 'Leave empty if you do not want to show the button.', 'chromatic' ),
'input_attrs' => array(
'placeholder' => 'http://',
),
),
),
);
$settings["wt_html_slide_{$slide}-background"] = array(
'label' => sprintf( __( 'Slide %s Background', 'chromatic' ), $slide),
'section' => $section,
'type' => 'betterbackground',
'priority' => 475, // Non static options must have a priority
'default' => array(
'color' => '#ffffff',
),
'options' => array( 'color', 'image', 'pattern' ),
);
} // end for
$section = 'slider_img';
$sections[ $section ] = array(
'title' => __( 'Widgetized Template - Image Slider', 'chromatic' ),
'panel' => $panel,
);
$settings['wt_img_slider_width'] = array(
'label' => __( 'Slider Width', 'chromatic' ),
'sublabel' => __("Note: This option is useful only if the Site Layout option is set to Stretched in 'Setup & Layout > Site Setup' panel.", 'chromatic'),
'section' => $section,
'type' => 'radioimage',
'choices' => array(
'boxed' => $imagepath . 'slider-width-boxed.png',
'stretch' => $imagepath . 'slider-width-stretch.png',
),
'default' => 'boxed',
);
$settings['wt_img_slider'] = array(
'label' => __( 'Slides', 'chromatic' ),
'section' => $section,
'type' => 'content',
'priority' => 485, // Non static options must have a priority
'content' => __( 'Premium version of this theme comes with capability to create Unlimited slides.', 'chromatic' ),
);
for ( $slide = 1; $slide <= 4; $slide++ ) {
$settings["wt_img_slide_{$slide}"] = array(
'label' => '',//sprintf( __( 'Slide %s Content', 'chromatic' ), $slide),
'section' => $section,
'type' => 'group',
'priority' => 485, // Non static options must have a priority
'button' => sprintf( __( 'Edit Slide %s', 'chromatic' ), $slide),
'options' => array(
'description' => array(
'label' => '',
'type' => 'content',
'content' => '' . sprintf( __( 'Slide %s Content', 'chromatic' ), $slide) . '' . __( 'To hide this slide, simply leave the Image empty.', 'chromatic' ),
),
'image' => array(
'label' => __( 'Slide Image', 'chromatic' ),
'type' => 'image',
'description' => __( 'The main showcase image.', 'chromatic' ),
),
'caption' => array(
'label' => __( 'Slide Caption (optional)', 'chromatic' ),
'type' => 'text',
),
'url' => array(
'label' => __( 'Slide Link', 'chromatic' ),
'type' => 'url',
'description' => __( 'Leave empty if you do not want to link the slide.', 'chromatic' ),
'input_attrs' => array(
'placeholder' => 'http://',
),
),
'button' => array(
'label' => __( 'Slide Button Text', 'chromatic' ),
'type' => 'text',
'description' => __( 'Leave empty if you do not want to show the button and instead link the slide image (if you have a url set in the above field)', 'chromatic' ),
),
),
);
} // end for
endif;
/*** Return Options Array ***/
return apply_filters( 'hoot_theme_customizer_options', array(
'settings' => $settings,
'sections' => $sections,
'panels' => $panels,
) );
}
endif;
/**
* Add Options (settings, sections and panels) to Hoot_Customizer class options object
*
* @since 3.0
* @access public
* @return void
*/
if ( !function_exists( 'hoot_theme_add_customizer_options' ) ) :
function hoot_theme_add_customizer_options() {
$hoot_customizer = Hoot_Customizer::get_instance();
// Add Options
$options = hoot_theme_customizer_options();
$hoot_customizer->add_options( array(
'settings' => $options['settings'],
'sections' => $options['sections'],
'panels' => $options['panels'],
) );
// Add Inforbuttons
$hoot_customizer->add_infobuttons( array(
'demo' => array( 'text' => __( 'Demo', 'chromatic'),
'url' => 'http://demo.wphoot.com/chromatic/',
'icon' => 'fa fa-eye' ),
'docs' => array( 'text' => __( 'Documentation & Support', 'chromatic'),
'url' => 'http://wphoot.com/support/',
'icon' => 'fa fa-support' ),
'rate' => array( 'text' => __( 'If you like this theme, support our work by giving it a 5 rating on wordpress.org :)', 'chromatic'),
'url' => 'https://wordpress.org/support/view/theme-reviews/chromatic#postform',
'icon' => 'fa fa-star' ),
) );
// Add Premium Infobutton
$hoot_customizer->add_infobuttons( array(
'premium' => array( 'text' => __( 'Premium', 'chromatic'),
'type' => 'premium',
'url' => 'http://wphoot.com/themes/chromatic/',
'icon' => 'fa fa-rocket' ),
) );
}
endif;
add_action( 'init', 'hoot_theme_add_customizer_options', 0 ); // cannot hook into 'after_setup_theme' as this hook is already being executed (this file is loaded at after_setup_theme @priority 10) (hooking into same hook from within while hook is being executed leads to undesirable effects as $GLOBALS[$wp_filter]['after_setup_theme'] has already been ksorted)
// Hence, we hook into 'init' @priority 0, so that settings array gets populated before 'widgets_init' action ( which itself is hooked to 'init' at priority 1 ) for creating widget areas ( settings array is needed for creating defaults when user value has not been stored )
/**
* Add Icons for WordPress Default Panels to Icon Nav
*
* @since 3.0
* @param array $panels
* @return array
*/
function hoot_customizer_panel_icons( $panels ) {
$panels['widgets'] = array(
'title' => __( 'Widgets & Sidebars', 'chromatic' ),
'icon' => 'dashicons dashicons-admin-plugins', // fa fa-puzzle-piece
);
global $wp_version;
if ( version_compare( $wp_version, '4.3', '>=' ) ) {
$panels['nav_menus'] = array(
'title' => __( 'Menus', 'chromatic' ),
'icon' => 'dashicons dashicons-menu', // fa fa-bars
);
}
return $panels;
}
add_filter( 'hoot_customizer_panel_icons', 'hoot_customizer_panel_icons' );
/**
* Add Content to JS object passed to hoot-customizer-script
*
* @since 3.2
* @param array $data
* @return array
*/
function hoot_theme_customizer_premium_fly_js_object( $data ) {
$data['premium-section-reorder'] ='true';
return $data;
}
add_filter( 'hoot_customizer_control_footer_js_data_objec', 'hoot_theme_customizer_premium_fly_js_object' );
/**
* Modify default WordPress Settings Sections and Panels
*
* @since 3.0
* @param object $wp_customize
* @return void
*/
function hoot_customizer_modify_default_options( $wp_customize ) {
if ( function_exists( 'the_custom_logo' ) ) {
$wp_customize->get_control( 'custom_logo' )->section = 'logo';
$wp_customize->get_control( 'custom_logo' )->priority = 45; // Replaces theme's logo_image // Update in premium if needed
$wp_customize->get_control( 'custom_logo' )->width = 280;
$wp_customize->get_control( 'custom_logo' )->height = 65;
// $wp_customize->get_control( 'custom_logo' )->type = 'image'; // Stored value becomes url instead of image ID (fns like the_custom_logo() dont work)
// Defaults: [type] => cropped_image, [width] => 150, [height] => 150, [flex_width] => 1, [flex_height] => 1, [button_labels] => array(...), [label] => Logo
$wp_customize->get_control( 'custom_logo' )->active_callback = 'hoot_callback_logo_image';
}
$wp_customize->get_section( 'title_tagline' )->panel = 'general';
$wp_customize->get_section( 'title_tagline' )->priority = 1;
$wp_customize->get_section( 'static_front_page' )->panel = 'content';
$wp_customize->get_section( 'static_front_page' )->priority = 1;
$wp_customize->get_section( 'colors' )->panel = 'styling';
// global $wp_version;
// if ( version_compare( $wp_version, '4.3', '>=' ) ) // 'Creating Default Object from Empty Value' error before 4.3 since 'nav_menus' panel did not exist ( we did have 'nav' section till 4.1.9 i.e. before 4.2 )
// $wp_customize->get_panel( 'nav_menus' )->priority = 999;
// This will set the priority, however will give a 'Creating Default Object from Empty Value' error first.
// $wp_customize->get_panel( 'widgets' )->priority = 999;
}
add_action( 'customize_register', 'hoot_customizer_modify_default_options', 100 );
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @since 3.0
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
* @return void
*/
function hoot_customizer_customize_register( $wp_customize ) {
// $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
}
add_action( 'customize_register', 'hoot_customizer_customize_register' );
/**
* Callback Functions for customizer settings
*/
function hoot_callback_logo_size( $control ) {
$selector = $control->manager->get_setting('logo')->value();
return ( $selector == 'text' || $selector == 'mixed' ) ? true : false;
}
function hoot_callback_site_title_icon( $control ) {
$selector = $control->manager->get_setting('logo')->value();
return ( $selector == 'text' ) ? true : false;
}
function hoot_callback_logo_image( $control ) {
$selector = $control->manager->get_setting('logo')->value();
return ( $selector == 'image' || $selector == 'mixed' ) ? true : false;
}
function hoot_callback_logo_image_width( $control ) {
$selector = $control->manager->get_setting('logo')->value();
return ( $selector == 'mixed' ) ? true : false;
}
function hoot_callback_show_tagline( $control ) {
$selector = $control->manager->get_setting('logo')->value();
return ( $selector == 'text' || $selector == 'mixed' ) ? true : false;
}
function hoot_callback_box_background_color( $control ) {
$selector = $control->manager->get_setting('site_layout')->value();
return ( $selector == 'boxed' ) ? true : false;
}