post_author is not respected * by WP's get_the_author() function. * * @param type $author The original author * @return string The desired author */ function cz_change_preview_author( $author ) { // Ensure that we are in the Customizer - otherwise, do nothing special. if ( is_viewing_preview() ) { return __( 'Author', 'bpq' ); } // Making it here means that no change should have been made. return $author; } /** * Force a specific category to appear on the post format mockups * located in the preview template. * * @param type $category The original category * @return string The desired category */ function cz_change_preview_category( $category ) { // Ensure that we are in the Customizer - otherwise, do nothing special. if ( is_viewing_preview() ) { return ''.__( 'Category', 'bpq' ).''; } // Making it here means that no change should have been made. return $category; } /** * Force specific content to appear on the post format mockups * located in the preview template. * * Note: It is necessary to change the content in this manner * because setting $post->post_content is not respected * by WP's get_the_content() function. * * @param type $content The original content * @return string The desired content */ function cz_change_preview_content( $content ) { // Ensure that we are in the Customizer - otherwise, do nothing special. if ( is_viewing_preview() ) { global $preview; if ( !empty( $preview ) ) { return $preview->post_content; } } // Making it here means that no change should have been made. return $content; } /** * Force a specific date to appear on the post format mockups * located in the preview template. * * @param string $date The original date * @param string $d Date format * @return string The desired date */ function cz_change_preview_date( $date, $d ) { // Ensure that we are in the Customizer - otherwise, do nothing special. if ( is_viewing_preview() ) { if ( empty( $d ) ) return mysql2date( get_option( 'date_format' ), time() ); else return mysql2date( $d, time() ); } // Making it here means that no change should have been made. return $date; } /** * Force a specific tag to appear on the post format mockups * located in the preview template. * * @param type $tag The original tag * @return string The desired tag */ function cz_change_preview_tag( $tag ) { // Ensure that we are in the Customizer - otherwise, do nothing special. if ( is_viewing_preview() ) { return ''.__( 'Tag', 'bpq' ).''; } // Making it here means that no change should have been made. return $tag; } /** * Shortcut for determining if a developer is on the Theme * Customizer screen AND viewing the preview template. */ function is_viewing_preview() { if ( \ski\question::is_customizer() ) { // OPTION: Preview $opt_preview_template = get_theme_mod( 'bpq_opt_preview_template', 'front' ); return ( $opt_preview_template == 'preview' ); } return false; } /** * TABLE OF CONTENTS - Theme Customizer * * SECTION: Preview * PANEL: Tones * SECTION: Color * SECTION: Flair * SECTION: Typography * PANEL: Frame * SECTION: Format * SECTION: Alarm * SECTION: Top bar * SECTION: Masthead * SECTION: Navigation * SECTION: Sidebars * SECTION: Pedestal * SECTION: Bottom bar * PANEL: Content * SECTION: General * SECTION: Metadata * SECTION: Paging * PANEL: Widgets * SECTION: * PANEL: Auxiliary * SECTION: Analytics * SECTION: Favicon * SECTION: Shop * SECTION: Control Tests (incoming from Ski.Web) * * Note: The individual section functions are generally listed in the * order that they appear from top-to-bottom in the customizer. */ /** * Registration of all panels, sections, and controls within the Customizer. */ function cz_register( $wp_customize ) { // Create panels to help organize sections. $wp_customize->add_panel( 'bpq_cz_panel_tones', array( 'title' => __( 'Tones', 'bpq' ), 'description' => __( 'Tones are great for quickly changing the feel of your whole site.', 'bpq' ), 'priority' => 2000 )); $wp_customize->add_panel( 'bpq_cz_panel_frame', array( 'title' => __( 'Frame', 'bpq' ), 'description' => __( 'Layout options for the static pieces of your website - like headers, footers, sidebars, and more.', 'bpq' ), 'priority' => 3000 )); $wp_customize->add_panel( 'bpq_cz_panel_content', array( 'title' => __( 'Content', 'bpq' ), 'description' => __( 'Change the display of dynamic articles and behavior of related functionality.', 'bpq' ), 'priority' => 4000 )); $wp_customize->add_panel( 'bpq_cz_panel_auxiliary', array( 'title' => __( 'Auxiliary', 'bpq' ), 'description' => __( 'Contains a number of other helpful options.', 'bpq' ), 'priority' => 6000 )); // Now add the sections that go within those panels - note that the // section calls here will define the section and the corresponding // controls within each section - this is the meat of the feature, // so the logic is offloaded into individual functions to make this // function a bit easier to digest. cz_register_section_preview( $wp_customize, '' ); cz_register_section_color( $wp_customize, 'bpq_cz_panel_tones' ); cz_register_section_flair( $wp_customize, 'bpq_cz_panel_tones' ); cz_register_section_type( $wp_customize, 'bpq_cz_panel_tones' ); cz_register_section_format( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_alarm( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_top( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_masthead( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_navigation( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_sidebars( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_pedestal( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_bottom( $wp_customize, 'bpq_cz_panel_frame' ); cz_register_section_leader( $wp_customize, 'bpq_cz_panel_content' ); cz_register_section_articles( $wp_customize, 'bpq_cz_panel_content' ); cz_register_section_pagination( $wp_customize, 'bpq_cz_panel_content' ); cz_register_section_analytics( $wp_customize, 'bpq_cz_panel_auxiliary' ); cz_register_section_favicon( $wp_customize, 'bpq_cz_panel_auxiliary' ); cz_register_section_login( $wp_customize, 'bpq_cz_panel_auxiliary' ); cz_register_section_shop( $wp_customize, 'bpq_cz_panel_auxiliary' ); // Finally, get rid of and/or alter panels/sections that come // with WP, but are not desired. $wp_customize->remove_section( 'title_tagline' ); $wp_customize->remove_section( 'static_front_page' ); $panel_widgets = $wp_customize->get_panel( 'widgets' ); if ( !empty( $panel_widgets ) ) { $panel_widgets->description = __( 'You can change which widget sections show up here by enabling/disabling options under the Frame Format section.', 'bpq' ); $panel_widgets->priority = 5000; } } /** * Registration of the Theme Customizer "Preview" section. This is a * special section that appears before all other sections. It contains * a single setting that allows a developer to select how they wish to * preview their settings (thus, drives the choice of customizer template). * * Note: The preview template is only available starting in the architect edition. * * SECTION: Preview * OPTION: Which page to preview (checkbox, choices: super preview, front page) */ function cz_register_section_preview( $wp_customize, $panel_id ) { $premium_desc = sprintf( __( 'The %s edition includes "Super Preview", which provides samples of individual elements.'. 'Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 3 ), sales::url_buy( 3 ) ); if ( BPQ_EDITION >= 3 ) { $premium_desc = __( 'Front pages are great for changing structure. BluePrint-Q also offers "Super Preview", which provides samples of individual elements.', 'bpq' ); } $wp_customize->add_section( 'bpq_cz_section_preview', array( 'title' => __( 'Preview', 'bpq' ), 'description' => $premium_desc, 'panel' => $panel_id, 'priority' => 1100 )); // LABEL: Template $premium_choices = array( 'front' => __( 'Wordpress\' Front Page', 'bpq' ) ); if ( BPQ_EDITION >= 3 ) { $premium_choices['preview'] = __( 'BluePrint-Q\'s Super Preview', 'bpq' ); } $wp_customize->add_setting( 'bpq_opt_preview_template', array( 'default' => 'front', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_text_ctl( $wp_customize, 'bpq_opt_preview_template', array( 'label' => __( 'Page to view only here?', 'bpq' ), 'desc_after' => sprintf( __( 'Note: Your front page can be set from the reading settings screen.', 'bpq' ), admin_url( 'options-reading.php' ) ), 'section' => 'bpq_cz_section_preview', 'choices' => $premium_choices, 'priority' => 10 ))); } /** * Registration of the Theme Customizer "Tones Color" section. * * SECTION: Colors * OPTION: Color scheme (dropdown list of all color-related css) */ function cz_register_section_color( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_color', array( 'title' => __( 'Color', 'bpq' ), 'description' => __( ' Many palettes are derived from the top listings shared at Adobe Kuler.', 'bpq' ), 'panel' => $panel_id, 'priority' => 2100 )); // Shortcut path pattern to the BPQ tones - remove the // root so the tone works on any local/remote server. $color_loc = 'tones/colors/bpq.tone.color.%s.css'; // Prepare the lists of tones - these will appear in any edition. $colors = array( sprintf( $color_loc, 'bootstrap' ) => __( 'Bootstrap', 'bpq' ), sprintf( $color_loc, 'gradient-blues' ) => __( 'Gradient Blues', 'bpq' ), sprintf( $color_loc, 'zen-garden' ) => __( 'Zen Garden', 'bpq' ), ); // Add more tones if using the architect edition. if ( BPQ_EDITION >= 2 ) { $colors_architect = array( sprintf( $color_loc, 'calm-of-the-sea' ) => __( 'Calm of the Sea', 'bpq' ), sprintf( $color_loc, 'cherry-cheesecake' ) => __( 'Cherry Cheesecake', 'bpq' ), sprintf( $color_loc, 'granny-smith-apple' ) => __( 'Granny Smith Apple', 'bpq' ), sprintf( $color_loc, 'iceberg' ) => __( 'Iceberg', 'bpq' ), sprintf( $color_loc, 'purple-rain' ) => __( 'Purple Rain', 'bpq' ), ); $colors = array_merge( $colors, $colors_architect ); } // Add more tones if using the premium edition. if ( BPQ_EDITION >= 3 ) { $colors_premium = array( sprintf( $color_loc, 'afternoon-chai' ) => __( 'Afternoon Chai', 'bpq' ), sprintf( $color_loc, 'associates' ) => __( 'Associates', 'bpq' ), sprintf( $color_loc, 'beachside-shopping' ) => __( 'Beachside Shopping', 'bpq' ), sprintf( $color_loc, 'business-casual' ) => __( 'Business Casual', 'bpq' ), sprintf( $color_loc, 'campfire' ) => __( 'Campfire', 'bpq' ), sprintf( $color_loc, 'circus' ) => __( 'Circus', 'bpq' ), sprintf( $color_loc, 'crystal-shadow' ) => __( 'Crystal Shadow', 'bpq' ), sprintf( $color_loc, 'demanding-angel' ) => __( 'Demanding Angel', 'bpq' ), sprintf( $color_loc, 'liberation' ) => __( 'Liberation', 'bpq' ), sprintf( $color_loc, 'model' ) => __( 'Model', 'bpq' ), sprintf( $color_loc, 'pink-peppermint' ) => __( 'Pink Peppermint', 'bpq' ), sprintf( $color_loc, 'salmon-on-ice' ) => __( 'Salmon on Ice', 'bpq' ), ); $colors = array_merge( $colors, $colors_premium ); } // See if the child theme has any tones to add to the lists - // only look for extending the list in premium edition. if ( BPQ_EDITION >= 3 ) { $colors = apply_filters( 'filter_bpq_tone_color_list', $colors ); } // Note: asort() places 'iApp' at the end because it is case-sensitive. There is a solution // using uasort() and strcasecmp() to sort being case-insensitive. Solution here: // http://board.phpbuilder.com/showthread.php?10185890-Case-insensitive-asort uasort( $colors, '\strcasecmp' ); // There is potential to have notices displayed under each tone dropdown. $notice_colors = sprintf( __( 'Upgrade to the %s Edition and work with many more gorgeous color palettes.' ), sales::url_buy( 2 ), sales::edition_name( 2 ) ); if ( BPQ_EDITION >= 2 ) { $notice_colors = ''; } // Color. $wp_customize->add_setting( 'bpq_opt_tone_color', array( 'default' => sprintf( $color_loc, 'gradient-blues' ), 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_tone_color', array( 'desc_after' => $notice_colors, 'choices' => $colors, 'section' => 'bpq_cz_section_color', 'priority' => 10 ))); } /** * Registration of the Theme Customizer "Tones Flair" section. * * SECTION: Flairs * OPTION: Style scheme (dropdown list of all flair-related css) */ function cz_register_section_flair( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_flair', array( 'title' => __( 'Flair', 'bpq' ), 'description' => __( ' Shapes the elements that make up the frame - can include borders, spacing, etc.', 'bpq' ), 'panel' => $panel_id, 'priority' => 2200 )); // Shortcut path pattern to the BPQ tones - remove the // root so the tone works on any local/remote server. $flair_loc = 'tones/flairs/bpq.tone.flair.%s.css'; // Prepare the lists of tones - these will appear in any edition. $flairs = array( sprintf( $flair_loc, 'architect' ) => __( 'Architect', 'bpq' ), sprintf( $flair_loc, 'blockhead' ) => __( 'Blockhead', 'bpq' ), sprintf( $flair_loc, 'bootstrap' ) => __( 'Bootstrap', 'bpq' ), sprintf( $flair_loc, 'merry-go-round' ) => __( 'Merry-go-Round', 'bpq' ), ); // Add more tones if using the architect edition. if ( BPQ_EDITION >= 2 ) { $flairs_architect = array( sprintf( $flair_loc, 'french-fried' ) => __( 'French Fried', 'bpq' ), sprintf( $flair_loc, 'minimalist' ) => __( 'Minimalist', 'bpq' ), sprintf( $flair_loc, 'movie-strip' ) => __( 'Movie Strip', 'bpq' ), sprintf( $flair_loc, 'radioactive' ) => __( 'Radioactive', 'bpq' ), ); $flairs = array_merge( $flairs, $flairs_architect ); } // Add more tones if using the premium edition. if ( BPQ_EDITION >= 3 ) { $flairs_premium = array( sprintf( $flair_loc, 'capsule' ) => __( 'Capsule', 'bpq' ), sprintf( $flair_loc, 'career-course' ) => __( 'Career Course', 'bpq' ), sprintf( $flair_loc, 'flagstaff' ) => __( 'Flagstaff', 'bpq' ), sprintf( $flair_loc, 'glowstick' ) => __( 'Glowstick', 'bpq' ), sprintf( $flair_loc, 'gridiron' ) => __( 'Gridiron', 'bpq' ), sprintf( $flair_loc, 'iapp' ) => __( 'iApp', 'bpq' ), sprintf( $flair_loc, 'model' ) => __( 'Model', 'bpq' ), sprintf( $flair_loc, 'olde-english' ) => __( 'Olde English', 'bpq' ), sprintf( $flair_loc, 'porthole' ) => __( 'Porthole', 'bpq' ), sprintf( $flair_loc, 'scales-of-justice' ) => __( 'Scales of Justice', 'bpq' ), sprintf( $flair_loc, 'spaced-out' ) => __( 'Spaced Out', 'bpq' ), sprintf( $flair_loc, 'weeping-willow' ) => __( 'Weeping Willow', 'bpq' ), sprintf( $flair_loc, 'whacky-shack' ) => __( 'Whacky Shack', 'bpq' ), ); $flairs = array_merge( $flairs, $flairs_premium ); } // See if the child theme has any tones to add to the lists - // only look for extending the list in premium edition. if ( BPQ_EDITION >= 3 ) { $flairs = apply_filters( 'filter_bpq_tone_flair_list', $flairs ); } // Note: asort() places 'iApp' at the end because it is case-sensitive. There is a solution // using uasort() and strcasecmp() to sort being case-insensitive. Solution here: // http://board.phpbuilder.com/showthread.php?10185890-Case-insensitive-asort uasort( $flairs, '\strcasecmp' ); // There is potential to have notices displayed under each tone dropdown. $notice_flairs = sprintf( __( 'Upgrade to the %s Edition and work with many more exciting flairs.' ), sales::url_buy( 2 ), sales::edition_name( 2 ) ); if ( BPQ_EDITION >= 2 ) { $notice_flairs = ''; } // Flair. $wp_customize->add_setting( 'bpq_opt_tone_flair', array( 'default' => sprintf( $flair_loc, 'architect' ), 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_tone_flair', array( 'desc_after' => $notice_flairs, 'choices' => $flairs, 'section' => 'bpq_cz_section_flair', 'priority' => 20 ))); } /** * Registration of the Theme Customizer "Tones Type" section. * * SECTION: Types * OPTION: Type scheme (dropdown list of all type-related css) */ function cz_register_section_type( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_type', array( 'title' => __( 'Type', 'bpq' ), 'description' => __( ' Heading/body combinations hand-selected from the Google Fonts library.', 'bpq' ), 'panel' => $panel_id, 'priority' => 2300 )); // Shortcut path pattern to the BPQ tones - remove the // root so the tone works on any local/remote server. $type_loc = 'tones/types/bpq.tone.type.%s.css'; // Prepare the lists of tones - these will appear in any edition. $types = array( sprintf( $type_loc, 'bootstrap' ) => __( 'Bootstrap', 'bpq' ), sprintf( $type_loc, 'funhouse' ) => __( 'Funhouse', 'bpq' ), sprintf( $type_loc, 'happy-hour' ) => __( 'Happy Hour', 'bpq' ), sprintf( $type_loc, 'magazine-digest' ) => __( 'Magazine Digest', 'bpq' ), sprintf( $type_loc, 'soundwave' ) => __( 'Soundwave', 'bpq' ), ); // Add more tones if using the architect edition. if ( BPQ_EDITION >= 2 ) { $types_architect = array( sprintf( $type_loc, 'circular-logic' ) => __( 'Circular Logic', 'bpq' ), sprintf( $type_loc, 'seafarer' ) => __( 'Seafarer', 'bpq' ), sprintf( $type_loc, 'symphony' ) => __( 'Symphony', 'bpq' ), ); $types = array_merge( $types, $types_architect ); } // Add more tones if using the premium edition. if ( BPQ_EDITION >= 3 ) { $types_premium = array( sprintf( $type_loc, '8-bit' ) => __( '8-Bit', 'bpq' ), sprintf( $type_loc, 'around-the-world' ) => __( 'Around the World', 'bpq' ), sprintf( $type_loc, 'artistic-license' ) => __( 'Artistic License', 'bpq' ), sprintf( $type_loc, 'cabin-fever' ) => __( 'Cabin Fever', 'bpq' ), sprintf( $type_loc, 'charitable-contribution' ) => __( 'Charitable Contribution', 'bpq' ), sprintf( $type_loc, 'clean-tek' ) => __( 'Clean Tek', 'bpq' ), sprintf( $type_loc, 'concrete-slab' ) => __( 'Concrete Slab', 'bpq' ), sprintf( $type_loc, 'electronic-reader' ) => __( 'Electronic Reader', 'bpq' ), sprintf( $type_loc, 'fashionista' ) => __( 'Fashionista', 'bpq' ), sprintf( $type_loc, 'fruit-basket' ) => __( 'Fruit Basket', 'bpq' ), sprintf( $type_loc, 'hot-air-balloon' ) => __( 'Hot-Air Balloon', 'bpq' ), sprintf( $type_loc, 'lake-eerie' ) => __( 'Lake "Eerie"', 'bpq' ), sprintf( $type_loc, 'loonie-toonie' ) => __( 'Loonie Toonie', 'bpq' ), sprintf( $type_loc, 'model' ) => __( 'Model', 'bpq' ), sprintf( $type_loc, 'nervous-nellie' ) => __( 'Nervous Nellie', 'bpq' ), sprintf( $type_loc, 'poetic-justice' ) => __( 'Poetic Justice', 'bpq' ), sprintf( $type_loc, 'showstopper' ) => __( 'Showstopper', 'bpq' ), sprintf( $type_loc, 'statement' ) => __( 'Statement', 'bpq' ), sprintf( $type_loc, 'superfriends' ) => __( 'Superfriends', 'bpq' ), ); $types = array_merge( $types, $types_premium ); } // See if the child theme has any tones to add to the lists - // only look for extending the list in premium edition. if ( BPQ_EDITION >= 3 ) { $types = apply_filters( 'filter_bpq_tone_type_list', $types ); } // Note: asort() places 'iApp' at the end because it is case-sensitive. There is a solution // using uasort() and strcasecmp() to sort being case-insensitive. Solution here: // http://board.phpbuilder.com/showthread.php?10185890-Case-insensitive-asort uasort( $types, '\strcasecmp' ); // There is potential to have notices displayed under each tone dropdown. $notice_types = sprintf( __( 'Upgrade to the %s Edition and work with many more sharp typography pairings.' ), sales::url_buy( 2 ), sales::edition_name( 2 ) ); if ( BPQ_EDITION >= 2 ) { $notice_types = ''; } // Typography. $wp_customize->add_setting( 'bpq_opt_tone_type', array( 'default' => sprintf( $type_loc, 'soundwave' ), 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_tone_type', array( 'desc_after' => $notice_types, 'choices' => $types, 'section' => 'bpq_cz_section_type', 'priority' => 30 ))); } /** * Registration of the Theme Customizer "Format" section. * * SECTION: Format * OPTION: Span (radio_image) * CHOICE: Full bleed, wide content (checkbox) * CHOICE: Full bleed, narrow content (checkbox) * CHOICE: Boxed, narrow content (checkbox) * LABEL: Header * OPTION: Display alarm? (checkbox) * OPTION: Display top bar? (checkbox) * OPTION: Display masthead? (checkbox) * OPTION: Display navigation bar? (checkbox) * LABEL: Sidebars * OPTION: (sidebar_layout) * LABEL: Footer * OPTION: Display pedestal? (checkbox) * OPTION: Display bottom bar? (checkbox) */ function cz_register_section_format( $wp_customize, $panel_id ) { // SECTION: Format $wp_customize->add_section( 'bpq_cz_section_format', array( 'title' => __( 'Format', 'bpq' ), 'description' => __( 'Give your site an overall structure.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3100 )); // LABEL: Span $wp_customize->add_setting( 'bpq_opt_format_site_span', array( 'default' => 'boxed-narrow', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_site_span_layout_ctl( $wp_customize, 'bpq_opt_format_site_span', array( 'label' => __( 'Span', 'bpq' ), 'desc' => __( 'Select a layout for the site', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 10 ))); // LABEL: Header $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Header', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_format_display_alarm', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); if ( BPQ_EDITION >= 2 ) { $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_format_display_alarm', array( 'option_text' => __( 'Display alarm', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 30 ))); } else { $upsell = sprintf( __( 'The alarm is available with the %s edition. '. 'Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 2 ), sales::url_buy( 2 ) ); $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $upsell, 'section' => 'bpq_cz_section_format', 'priority' => 30 ))); } $wp_customize->add_setting( 'bpq_opt_format_display_top', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_format_display_top', array( 'option_text' => __( 'Display top bar', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_format_display_masthead', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_format_display_masthead', array( 'option_text' => __( 'Display masthead', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 50 ))); $wp_customize->add_setting( 'bpq_opt_format_display_navigation', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_format_display_navigation', array( 'option_text' => __( 'Display navigation bar', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 60 ))); // LABEL: Sidebars $wp_customize->add_setting( 'bpq_opt_format_sidebar_layout', array( 'default' => 'r1', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_sidebar_layout_ctl( $wp_customize, 'bpq_opt_format_sidebar_layout', array( 'label' => __( 'Sidebars', 'bpq' ), 'desc' => __( 'Select the layout and number of sidebars', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 70 ))); // LABEL: Footer $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Footer', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 80 ))); $wp_customize->add_setting( 'bpq_opt_format_display_pedestal', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_format_display_pedestal', array( 'option_text' => __( 'Display pedestal', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 90 ))); $wp_customize->add_setting( 'bpq_opt_format_display_bottom', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); if ( BPQ_EDITION >= 2 ) { $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_format_display_bottom', array( 'option_text' => __( 'Display bottom bar', 'bpq' ), 'section' => 'bpq_cz_section_format', 'priority' => 100 ))); } else { $upsell = sprintf( __( 'The bottom bar is available with the %s edition. '. 'Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 2 ), sales::url_buy( 2 ) ); $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $upsell, 'section' => 'bpq_cz_section_format', 'priority' => 100 ))); } } /** * Registration of the Theme Customizer "Alarm" section. * * SECTION: Alarm * LABEL: Text * OPTION: Headline (textbox) * OPTION: Caption (textbox) * OPTION: Alignment (radio_image_horizontal_alignment) * LABEL: Classification * OPTION: (dropdown choices: Info, Success, Warning, Danger) * OPTION: User can dismiss the alarm? (checkbox) */ function cz_register_section_alarm( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_alarm', array( 'title' => __( 'Alarm', 'bpq' ), 'description' => __( 'Call out an important message to your visitors.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3200 )); // Headline $wp_customize->add_setting( 'bpq_opt_alarm_headline', array( 'default' => '', 'sanitize_callback' => '\sanitize_text_field' ) ); $wp_customize->add_control( new \ski\cz_textbox_ctl( $wp_customize, 'bpq_opt_alarm_headline', array( 'label' => __( 'Headline', 'bpq' ), 'desc' => __( 'This text will be boldfaced', 'bpq' ), 'section' => 'bpq_cz_section_alarm', 'priority' => 10 ))); // Caption $wp_customize->add_setting( 'bpq_opt_alarm_caption', array( 'default' => '', 'sanitize_callback' => '\sanitize_text_field' ) ); $wp_customize->add_control( new \ski\cz_textbox_ctl( $wp_customize, 'bpq_opt_alarm_caption', array( 'label' => __( 'Caption', 'bpq' ), 'desc' => __( 'This text will not be boldfaced', 'bpq' ), 'section' => 'bpq_cz_section_alarm', 'priority' => 20 ))); // Text alignment $wp_customize->add_setting( 'bpq_opt_alarm_alignment', array( 'default' => 'mc', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_alarm_alignment', array( 'label' => __( 'Alignment', 'bpq' ), 'section' => 'bpq_cz_section_alarm', 'priority' => 30 ))); // Classification $wp_customize->add_setting( 'bpq_opt_alarm_color', array( 'default' => 'alert-warning', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_alarm_color', array( 'label' => __( 'Classification', 'bpq' ), 'section' => 'bpq_cz_section_alarm', 'choices' => array( 'alert-info' => 'Info', 'alert-success' => 'Success', 'alert-warning' => 'Warning', 'alert-danger' => 'Danger' ), 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_alarm_dismissable', array( 'default' => true, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_alarm_dismissable', array( 'option_text' => __( 'User can dismiss the alarm', 'bpq' ), 'section' => 'bpq_cz_section_alarm', 'priority' => 50 ))); } /** * Registration of the Theme Customizer "Top" section. * * SECTION: Top (visible: Format > Header > Display top bar) * OPTION: Alignment (radio_image_horizontal_alignment) */ function cz_register_section_top( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_top', array( 'title' => __( 'Top Bar', 'bpq' ), 'description' => __( 'An area at the top that can help frame the site and offer information.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3300 )); // Alignment $wp_customize->add_setting( 'bpq_opt_top_alignment', array( 'default' => 'mc', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_top_alignment', array( 'label' => __( 'Alignment', 'bpq' ), 'section' => 'bpq_cz_section_top', 'priority' => 10 ))); // Notices $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => __( 'Note: Widgets can be altered by expanding the corresponding section.', 'bpq' ), 'section' => 'bpq_cz_section_top', 'priority' => 20 ))); } /** * Registration of the Theme Customizer "Masthead" section. * * SECTION: Masthead (visible: Format > Header > Display masthead) * OPTION: Purpose (radio_text) * CHOICE: Logo * OPTION: (media_selector) * OPTION: Size (number_bar range: +5 to +95) * CHOICE: Title & Tagline * OPTION: Title (textbox) * OPTION: Tagline (textbox) * OPTION: One line or two (checkbox) * OPTION: Alignment (radio_image_horizontal_alignment) */ function cz_register_section_masthead( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_masthead', array( 'title' => __( 'Masthead', 'bpq' ), 'description' => __( 'A large horizontal area typically for a design.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3400 )); // Purpose $wp_customize->add_setting( 'bpq_opt_masthead_purpose', array( 'default' => 'text', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_text_ctl( $wp_customize, 'bpq_opt_masthead_purpose', array( 'label' => __( 'Purpose', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'choices' => array( 'image' => __( ' Image/logo', 'bpq' ), 'text' => __( ' Title and tagline', 'bpq' ), ), 'priority' => 10 ))); $wp_customize->add_setting( 'bpq_opt_masthead_image', array( 'default' => -1, 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_media_library_ctl( $wp_customize, 'bpq_opt_masthead_image', array( 'section' => 'bpq_cz_section_masthead', 'priority' => 20 ))); $wp_customize->add_control( new \ski\cz_textbox_ctl( $wp_customize, 'blogname', array( 'placeholder' => __( 'Blog title', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'priority' => 30 ))); $wp_customize->add_control( new \ski\cz_textbox_ctl( $wp_customize, 'blogdescription', array( 'placeholder' => __( 'Blog description', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_masthead_single_line', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_masthead_single_line', array( 'option_text' => __( 'Display on a single line', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'priority' => 50 ))); // Layout $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Layout', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'priority' => 60 ))); $wp_customize->add_setting( 'bpq_opt_masthead_hide_mobile', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_masthead_hide_mobile', array( 'option_text' => __( 'Hide masthead on mobile devices', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'priority' => 70 ))); $wp_customize->add_setting( 'bpq_opt_masthead_use_widgets', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_masthead_use_widgets', array( 'option_text' => __( 'Split the masthead', 'bpq' ), 'desc_after' => __( 'Note: By splitting the masthead, you can display widgets alongside your logo.', 'bpq' ), 'section' => 'bpq_cz_section_masthead', 'priority' => 80 ))); } /** * Registration of the Theme Customizer "Navigation" section. * * SECTION: Navigation (visible: Format > Header > Display navigation bar) * OPTION: Menu (drop_menu) * OPTION: Brand (radio_text) * CHOICE: Logo * OPTION: (media_selector) * OPTION: Vertical offset (number_bar -50/+50) * CHOICE: Title * OPTION: Title (textbox note: same as the one in the Masthead section) * OPTION: Hide on mobile * LABEL: Additional buttons * OPTION: Cart (checkbox) * OPTION: Login (checkbox) * OPTION: Search (checkbox) * OPTION: Scheme (dropdown choices: light, dark) */ function cz_register_section_navigation( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_navigation', array( 'title' => __( 'Navigation', 'bpq' ), 'description' => __( 'The main navigation area for your site.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3500 )); // Menu // Note: Try reusing the menu control that WP already provides to keep consistent with theme location. $navbar_menu_location_control = $wp_customize->get_control( 'nav_menu_locations[navbar]' ); // If no menus have been created, kick out of this section with an informative message. if ( $navbar_menu_location_control ) { $navbar_menu_location_control->label = __( 'Menu', 'bpq' ); $navbar_menu_location_control->description = sprintf( __( 'You can create/delete menus on the Edit Menus screen.', 'bpq' ), admin_url( 'nav-menus.php' ) ); $navbar_menu_location_control->section = 'bpq_cz_section_navigation'; $navbar_menu_location_control->priority = 10; } else { $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Menu', 'bpq' ), 'desc' => sprintf( __( 'To select a menu, please go to the Edit Menus screen to create one first.', 'bpq' ), admin_url( 'nav-menus.php' ) ), 'section' => 'bpq_cz_section_navigation', 'priority' => 10 ))); } // Brand $wp_customize->add_setting( 'bpq_opt_navigation_purpose', array( 'default' => 'logo', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_text_ctl( $wp_customize, 'bpq_opt_navigation_purpose', array( 'label' => __( 'Brand', 'bpq' ), 'choices' => array( 'logo' => __( ' Logo', 'bpq' ), 'text' => __( ' Text', 'bpq' ) ), 'section' => 'bpq_cz_section_navigation', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_navigation_logo', array( 'default' => -1, 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_media_library_ctl( $wp_customize, 'bpq_opt_navigation_logo', array( 'desc' => __( 'Logo', 'bpq' ), 'desc_after' => __( 'Large images could be resized', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 30 ))); $wp_customize->add_setting( 'bpq_opt_navigation_logo_offset', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_number_bar_ctl( $wp_customize, 'bpq_opt_navigation_logo_offset', array( 'desc' => __( 'Offset', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'display' => 'none', 'min' => -25, 'max' => 25, 'step' => 1, 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_navigation_brand_text', array( 'default' => '', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_textbox_ctl( $wp_customize, 'bpq_opt_navigation_brand_text', array( 'placeholder' => __( 'Your brand text goes here', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 50 ))); $wp_customize->add_setting( 'bpq_opt_navigation_hide_mobile', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_navigation_hide_mobile', array( 'desc' => __( 'Tiny viewports can feel crowded.', 'bpq' ), 'option_text' => __( 'Hide brand on mobile devices', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 60 ))); // Additional buttons $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'More buttons', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 70 ))); $wp_customize->add_setting( 'bpq_opt_navigation_display_cart', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $woo_warning = ''; if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) $woo_warning = __( 'Requires WooCommerce activation', 'bpq' ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_navigation_display_cart', array( 'desc_after' => $woo_warning, 'option_text' => __( ' Display cart', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 80 ))); $wp_customize->add_setting( 'bpq_opt_navigation_display_login', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_navigation_display_login', array( 'option_text' => __( ' Display login', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 90 ))); $wp_customize->add_setting( 'bpq_opt_navigation_display_search', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_navigation_display_search', array( 'option_text' => __( ' Display search', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 100 ))); // Scheme $wp_customize->add_setting( 'bpq_opt_navigation_scheme', array( 'default' => 'tone', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_navigation_scheme', array( 'label' => __( 'Scheme', 'bpq' ), 'desc_after' => __( 'BluePrint-Q Tone will use the options you have specified in the Tone section.', 'bpq' ), 'choices' => array( 'navbar-default' => 'Bootstrap Light', 'navbar-inverse' => 'Bootstrap Dark', 'tone' => 'BluePrint-Q Tone' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 110 ))); // Behavior $wp_customize->add_setting( 'bpq_opt_navigation_affix', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_navigation_affix', array( 'label' => __( 'Behavior', 'bpq' ), 'option_text' => __( 'Affix when scrolled offscreen', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 120 ))); $wp_customize->add_setting( 'bpq_opt_navigation_animate', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_navigation_animate', array( 'option_text' => __( 'Execute animations', 'bpq' ), 'section' => 'bpq_cz_section_navigation', 'priority' => 130 ))); } /** * Registration of the Theme Customizer "Sidebars" section. * * SECTION: Sidebars (visible: Format > Sidebars > Anything but 0) * OPTION: Alignment (radio_image_horizontal_alignment) */ function cz_register_section_sidebars( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_sidebars', array( 'title' => __( 'Sidebars', 'bpq' ), 'description' => __( 'Additional column(s) that contain supplemental info.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3600 )); // Display $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Display', 'bpq' ), 'section' => 'bpq_cz_section_sidebars', 'priority' => 10 ))); $wp_customize->add_setting( 'bpq_opt_sidebars_hide_mobile_left', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_sidebars_hide_mobile_left', array( 'option_text' => __( 'Hide left sidebars on mobile devices', 'bpq' ), 'section' => 'bpq_cz_section_sidebars', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_sidebars_hide_mobile_right', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_sidebars_hide_mobile_right', array( 'option_text' => __( 'Hide right sidebars on mobile devices', 'bpq' ), 'section' => 'bpq_cz_section_sidebars', 'priority' => 30 ))); // Size $wp_customize->add_setting( 'bpq_opt_sidebars_size', array( 'default' => '3', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_sidebars_size', array( 'label' => __( 'Size', 'bpq' ), 'choices' => array( '3' => '- Default -', '2' => 'Shorter width', '4' => 'Larger width', ), 'section' => 'bpq_cz_section_sidebars', 'priority' => 40 ))); // Alignment $wp_customize->add_setting( 'bpq_opt_sidebars_alignment', array( 'default' => 'ml', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_sidebars_alignment', array( 'label' => __( 'Alignment', 'bpq' ), 'section' => 'bpq_cz_section_sidebars', 'priority' => 50 ))); // Notices $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => __( 'Note: Widgets can be altered by expanding the corresponding section.', 'bpq' ), 'section' => 'bpq_cz_section_sidebars', 'priority' => 60 ))); } /** * Registration of the Theme Customizer "Pedestal" section. * * SECTION: Pedestal (visible: Format > Footer > Pedestal) * LABEL: Number of sections * OPTION: (drop 1, 2, 3, 4, 6) * OPTION: Alignment (radio_image_horizontal_alignment) */ function cz_register_section_pedestal( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_pedestal', array( 'title' => __( 'Pedestal', 'bpq' ), 'description' => __( 'A large space that can anchor the site typically with social connections, newsletter sign-ups, etc.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3700 )); // Number of sections $wp_customize->add_setting( 'bpq_opt_pedestal_sections', array( 'default' => '3', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_pedestal_sections', array( 'label' => __( 'Number of widgetized areas', 'bpq' ), 'choices' => array( '1' => '1 @ 100% full width', '2' => '2 @ 50% width each', '3' => '3 @ 33% width each', '4' => '4 @ 25% width each', '6' => '6 @ 17% width each', ), 'section' => 'bpq_cz_section_pedestal', 'priority' => 10 ))); // Alignment $wp_customize->add_setting( 'bpq_opt_pedestal_align', array( 'default' => 'mc', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_pedestal_align', array( 'label' => __( 'Alignment', 'ski' ), 'section' => 'bpq_cz_section_pedestal', 'priority' => 20 ))); // LABEL: How-to $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => __( 'Tip: To add content, please either use the corresponding widget sections or '. 'visit the widgets page', 'bpq' ), 'section' => 'bpq_cz_section_pedestal', 'priority' => 30 ))); } /** * Registration of the Theme Customizer "Bottom" section. * * SECTION: Bottom (visible: Format > Header > Display bottom bar) * OPTION: Alignment (radio_image_horizontal_alignment) */ function cz_register_section_bottom( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_bottom', array( 'title' => __( 'Bottom Bar', 'bpq' ), 'description' => __( 'An area at the bottom that can help frame the site and offer information.', 'bpq' ), 'panel' => $panel_id, 'priority' => 3800 )); $notice = sprintf( __( 'The %s edition enables the use of widgets '. 'in this bottom bar. Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 2 ), sales::url_buy( 2 ) ); if ( BPQ_EDITION >= 2 ) { $notice = __( 'Note: Widgets can be altered by expanding the corresponding section.', 'bpq' ); } // Alignment - do not show with the freebie if ( BPQ_EDITION >= 2 ) { $wp_customize->add_setting( 'bpq_opt_bottom_alignment', array( 'default' => 'mc', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_bottom_alignment', array( 'label' => __( 'Alignment', 'bpq' ), 'section' => 'bpq_cz_section_bottom', 'priority' => 10 ))); } // Notices - changes based on the edition $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $notice, 'section' => 'bpq_cz_section_bottom', 'priority' => 20 ))); } /** * Registration of the Theme Customizer "Content Leader" section. * * SECTION: Leader * LABEL: High priority * OPTION: Display breadcrumbs (checkbox) * OPTION: Bring stickies to the top (checkbox) * LABEL: Highlight alignment * OPTION: Alignment (radio_image_horizontal_alignment) * LABEL: Featured image * OPTION: Display on archive pages (checkbox) * OPTION: Image size for archives (dropdown list of all registered image sizes) * OPTION: Display on singular pages (checkbox) * OPTION: Image size for singulars (dropdown list of all registered image sizes) */ function cz_register_section_leader( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_leader', array( 'title' => __( 'Leader', 'bpq' ), 'description' => __( 'This section is concerned with elements of greater focus.', 'bpq' ), 'panel' => $panel_id, 'priority' => 4100 )); // High priority $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'High priority', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 10 ))); $wp_customize->add_setting( 'bpq_opt_content_breadcrumbs', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_breadcrumbs', array( 'option_text' => __( ' Breadcrumbs', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_content_stickies', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_stickies', array( 'option_text' => __( ' Bring stickies to the top', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 30 ))); // Alignment $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Highlight alignment', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_content_highlight_alignment', array( 'default' => 'mc', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_content_highlight_alignment', array( 'section' => 'bpq_cz_section_leader', 'priority' => 50 ))); // Featured images $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Featured image', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 60 ))); $wp_customize->add_setting( 'bpq_opt_content_featured_image_display_emblem', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_featured_image_display_emblem', array( 'desc_after' => __( 'Emblems are usually smaller, square-cropped, and flow with article summaries.', 'bpq' ), 'option_text' => __( ' Display emblems', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 70 ))); $wp_customize->add_setting( 'bpq_opt_content_featured_image_display_pennant', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_featured_image_display_pennant', array( 'desc_after' => __( 'Pennants are usually larger, vertically-cropped, and sit above full-content articles.', 'bpq' ), 'option_text' => __( ' Display pennants', 'bpq' ), 'section' => 'bpq_cz_section_leader', 'priority' => 80 ))); } /** * Registration of the Theme Customizer "Content Articles" section. * * SECTION: Content * LABEL: Read more * OPTION: Use 'read more' links (checkbox) * OPTION: Read more text (textbox) * LABEL: Article alignment * OPTION: Alignment (radio_image_horizontal_alignment) * LABEL: Post metadata * OPTION: Display author (checkbox) * OPTION: Display categories (checkbox) * OPTION: Display comments (checkbox) * OPTION: Display date (checkbox) * OPTION: Date link type (drop: daily, monthly, yearly, visible when Display date is checked) * OPTION: Display tags (checkbox) */ function cz_register_section_articles( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_articles', array( 'title' => __( 'Articles', 'bpq' ), 'description' => __( 'Primarily focused on posts/pages.', 'bpq' ), 'panel' => $panel_id, 'priority' => 4200 )); // Read more $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Read more', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 10 ))); $wp_customize->add_setting( 'bpq_opt_content_read_more', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_read_more', array( 'option_text' => __( ' Use *read more* links', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_content_read_more_text', array( 'default' => '', 'sanitize_callback' => '\sanitize_text_field' ) ); $wp_customize->add_control( new \ski\cz_textbox_ctl( $wp_customize, 'bpq_opt_content_read_more_text', array( 'desc_after' => __( 'Leave blank to use the default text', 'bpq' ), 'placeholder' => __( 'Change *read more* text?', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 30 ))); // Alignment $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Article alignment', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_content_article_alignment', array( 'default' => 'ml', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_radio_image_align_x_ctl( $wp_customize, 'bpq_opt_content_article_alignment', array( 'section' => 'bpq_cz_section_articles', 'priority' => 50 ))); // Post metadata $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Metadata', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 60 ))); $wp_customize->add_setting( 'bpq_opt_content_display_author', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_display_author', array( 'option_text' => __( ' Display author', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 70 ))); $wp_customize->add_setting( 'bpq_opt_content_display_categories', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_display_categories', array( 'option_text' => __( ' Display categories', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 80 ))); $wp_customize->add_setting( 'bpq_opt_content_display_comments', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_display_comments', array( 'option_text' => __( ' Display comments', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 90 ))); $wp_customize->add_setting( 'bpq_opt_content_display_date', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_display_date', array( 'option_text' => __( ' Display date', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 100 ))); $wp_customize->add_setting( 'bpq_opt_content_date_archive_type', array( 'default' => 'month', 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_drop_ctl( $wp_customize, 'bpq_opt_content_date_archive_type', array( 'choices' => array( 'day' => 'Link to the daily archive', 'month' => 'Link to the monthly archive', 'year' => 'Link to the yearly archive' ), 'section' => 'bpq_cz_section_articles', 'priority' => 110 ))); $wp_customize->add_setting( 'bpq_opt_content_display_tags', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_display_tags', array( 'option_text' => __( ' Display tags', 'bpq' ), 'section' => 'bpq_cz_section_articles', 'priority' => 120 ))); } /** * Registration of the Theme Customizer "Content Pagination" section. * * SECTION: Content * LABEL: Paging * OPTION: Display above blog (checkbox) * OPTION: Display below blog (checkbox) * OPTION: Display train (checkbox) * OPTION: Train length (number_bar, range 0 - +7, visible when Display train is checked) */ function cz_register_section_pagination( $wp_customize, $panel_id ) { $wp_customize->add_section( 'bpq_cz_section_pagination', array( 'title' => __( 'Pagination', 'bpq' ), 'description' => __( 'Change the navigation controls displayed at the top and/or bottom of each page/post.', 'bpq' ), 'panel' => $panel_id, 'priority' => 4300 )); // Paging $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'label' => __( 'Paging', 'bpq' ), 'section' => 'bpq_cz_section_pagination', 'priority' => 10 ))); $wp_customize->add_setting( 'bpq_opt_content_paging_above', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_paging_above', array( 'option_text' => __( ' Display above blog', 'bpq' ), 'section' => 'bpq_cz_section_pagination', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_content_paging_below', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_paging_below', array( 'option_text' => __( ' Display below blog', 'bpq' ), 'section' => 'bpq_cz_section_pagination', 'priority' => 30 ))); $wp_customize->add_setting( 'bpq_opt_content_paging_train', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_content_paging_train', array( 'option_text' => __( ' Display page-link train', 'bpq' ), 'section' => 'bpq_cz_section_pagination', 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_content_paging_train_size', array( 'default' => 2, 'sanitize_callback' => array( '\ski\sanitize', 'none' ) ) ); $wp_customize->add_control( new \ski\cz_number_bar_ctl( $wp_customize, 'bpq_opt_content_paging_train_size', array( 'section' => 'bpq_cz_section_pagination', 'display' => 'range', 'min' => 0, 'min_text' => 'less', 'max' => 7, 'max_text' => 'more', 'step' => 1, 'priority' => 50 ))); } /** * Registration of the Theme Customizer "Analytics" section. * * SECTION: Analytics * PLUGIN: Google Analytics */ function cz_register_section_analytics( $wp_customize, $panel_id ) { $section = $wp_customize->get_section( 'bpq_cz_section_analytics' ); if ( $section ) { $section->panel = $panel_id; $section->priority = 6100; } else { $wp_customize->add_section( 'bpq_cz_section_analytics', array( 'title' => __( 'Analytics', 'bpq' ), 'description' => sprintf( __( 'Google Analytics offers some great insights on your visitors\' behavior.', 'bpq' ), 'http://www.google.com/analytics/' ), 'panel' => $panel_id, 'priority' => 6100 )); } // Analytics if ( !is_plugin_active( 'bpq.analytics/bpq.analytics.php' ) ) { // Reminder to activate the plugin. $msg = sprintf( __( 'Please install/activate the BluePrint-Q: Analytics plugin to use this feature.', 'bpq' ), admin_url( 'themes.php?page=tgmpa-install-plugins' ) ); // Or upsell, instead. if ( BPQ_EDITION < 3 ) { $msg = sprintf( __( 'This feature is available with the %s edition. '. 'Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 3 ), sales::url_buy( 3 ) ); } $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $msg, 'section' => 'bpq_cz_section_analytics', 'priority' => 10 ))); } } /** * Registration of the Theme Customizer "Favicon" section. * * SECTION: Analytics * PLUGIN: Favicon */ function cz_register_section_favicon( $wp_customize, $panel_id ) { $section = $wp_customize->get_section( 'bpq_cz_section_favicon' ); if ( $section ) { $section->panel = $panel_id; $section->priority = 6200; } else { $wp_customize->add_section( 'bpq_cz_section_favicon', array( 'title' => __( 'Favicon', 'bpq' ), 'description' => __( 'The icon selected here is typically displayed in a browser\'s tab.', 'bpq' ), 'panel' => $panel_id, 'priority' => 6200 )); } // Favicon if ( !is_plugin_active( 'bpq.favicon/bpq.favicon.php' ) ) { // Reminder to activate the plugin. $msg = sprintf( __( 'Please install/activate the BluePrint-Q: Favicon plugin to use this feature.', 'bpq' ), admin_url( 'themes.php?page=tgmpa-install-plugins' ) ); // Or upsell, instead. if ( BPQ_EDITION < 2 ) { $msg = sprintf( __( 'This feature is available with the %s edition. '. 'Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 2 ), sales::url_buy( 2 ) ); } $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $msg, 'section' => 'bpq_cz_section_favicon', 'priority' => 10 ))); } } /** * Registration of the Theme Customizer "Login" section. * * SECTION: Analytics * PLUGIN: Login */ function cz_register_section_login( $wp_customize, $panel_id ) { $section = $wp_customize->get_section( 'bpq_cz_section_login' ); if ( $section ) { $section->panel = $panel_id; $section->priority = 6300; } else { $wp_customize->add_section( 'bpq_cz_section_login', array( 'title' => __( 'Login', 'bpq' ), 'description' => __( 'Change the login, register, and lost password screens.', 'bpq' ), 'panel' => 'bpq_cz_panel_auxiliary', 'priority' => 6300 )); } // Login if ( !is_plugin_active( 'bpq.login/bpq.login.php' ) ) { // Reminder to activate the plugin. $msg = sprintf( __( 'Please install/activate the BluePrint-Q: Login plugin to use this feature.', 'bpq' ), admin_url( 'themes.php?page=tgmpa-install-plugins' ) ); // Or upsell, instead. if ( BPQ_EDITION < 3 ) { $msg = sprintf( __( 'This feature is available with the %s edition. '. 'Upgrade today!', 'bpq' ), framework::url_download(), sales::edition_name( 3 ), sales::url_buy( 3 ) ); } $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $msg, 'section' => 'bpq_cz_section_login', 'priority' => 10 ))); } } /** * Registration of the Theme Customizer "Shop" section. * * SECTION: Shop * CHECKBOX: Show "stock image" text? */ function cz_register_section_shop( $wp_customize, $panel_id ) { $section = $wp_customize->get_section( 'bpq_cz_section_shop' ); if ( $section ) { $section->panel = $panel_id; $section->priority = 6400; } else { $wp_customize->add_section( 'bpq_cz_section_shop', array( 'title' => __( 'Shop', 'bpq' ), 'description' => __( 'Change your product inventory display.', 'bpq' ), 'panel' => $panel_id, 'priority' => 6400 )); } // Notice if WC is not installed/activated. if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) { $notice = sprintf( __( 'Note: To use this feature, you must have WooCommerce installed and activated.', 'bpq' ), admin_url( 'themes.php?page=tgmpa-install-plugins' ) ); $wp_customize->add_control( new \ski\cz_detail_ctl( $wp_customize, '', array( 'desc' => $notice, 'section' => 'bpq_cz_section_shop', 'priority' => 10 ))); return; } // // Making it here means that WC is installed/activated. // $wp_customize->add_setting( 'bpq_opt_shop_display_stock_image_disclaimer', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_shop_display_stock_image_disclaimer', array( 'option_text' => __( ' Use *stock image* disclaimer', 'bpq' ), 'section' => 'bpq_cz_section_shop', 'priority' => 20 ))); $wp_customize->add_setting( 'bpq_opt_shop_display_result_count', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_shop_display_result_count', array( 'option_text' => __( ' Use result count', 'bpq' ), 'section' => 'bpq_cz_section_shop', 'priority' => 30 ))); $wp_customize->add_setting( 'bpq_opt_shop_display_sort_options', array( 'default' => 1, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_shop_display_sort_options', array( 'option_text' => __( ' Use sort options', 'bpq' ), 'section' => 'bpq_cz_section_shop', 'priority' => 40 ))); $wp_customize->add_setting( 'bpq_opt_shop_display_catalog_stock_status', array( 'default' => 0, 'sanitize_callback' => array( '\ski\sanitize', 'checkbox' ) ) ); $wp_customize->add_control( new \ski\cz_checkbox_ctl( $wp_customize, 'bpq_opt_shop_display_catalog_stock_status', array( 'option_text' => __( ' Use stock status in catalog', 'bpq' ), 'section' => 'bpq_cz_section_shop', 'priority' => 50 ))); } /** * Contains a number of functions that work on variable settings. * @since 1.0 */ class settings { /* PUBLIC */ /** * Retrieves the selected sidebars layout with respect to the selection * in the customizer (site-wide) and the potential page override. * @return string A value like '0', 'l1', 'l2', 'l1r1', 'r1', or 'r2' */ public static function format_sidebars() { if ( is_singular() ) { if ( \ski\post::get_opt( 'bpq_popt_sidebars_override', null ) == 'on' ) { return \ski\post::get_opt( 'bpq_popt_sidebars_layout', 'r1' ); } } return apply_filters( 'filter_bpq_setting_format_sidebars', get_theme_mod( 'bpq_opt_format_sidebar_layout', 'r1' ) ); } /** * Retrieves the selected site span with respect to the selection * in the customizer (site-wide) and the potential page override. * @return string A value like 'bleed-wide', 'bleed-narrow', or 'boxed-narrow' */ public static function format_span() { if ( is_singular() ) { if ( \ski\post::get_opt( 'bpq_popt_span_override', null ) == 'on' ) { return \ski\post::get_opt( 'bpq_popt_span', 'boxed-narrow' ); } } return apply_filters( 'filter_bpq_setting_format_span', get_theme_mod( 'bpq_opt_format_site_span', 'boxed-narrow' ) ); } /** * Retrieves the slug of the sidebar to use on the leftmost * side with respect to the potential page override. * @return string If set, the override; otherwise 'sidebar-1' */ public static function sidebars_1() { if ( is_singular() ) { $override = \ski\post::get_opt( 'bpq_popt_sidebars_1', null ); if ( !empty( $override ) ) { return $override; } } return 'sidebar-1'; } /** * Retrieves the slug of the sidebar to use on the leftmost * side with respect to the potential page override. * @return string If set, the override; otherwise 'sidebar-2' */ public static function sidebars_2() { if ( is_singular() ) { $override = \ski\post::get_opt( 'bpq_popt_sidebars_2', null ); if ( !empty( $override ) ) { return $override; } } return 'sidebar-2'; } /* PRIVATE */ /** * Only use this class as a utility. */ private function __construct() { // Intentionally blank.. } } ?>