'mc', 'caption' => '', 'delimiter' => '', 'headline' => '', 'is_dismissable' => true, 'purpose_class' => 'alert-info', ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the parameters. $class = 'alert'; $content = ''; // If this alarm should be dismissable, give it the class that // Bootstrap requires and an X button so the user can close it. if ( $args->is_dismissable ) { $class .= ' alert-dismissable'; $content .= ''; } // Only if the headline and caption are empty, then use a set of defaults. $headline_exists = ( strlen( $args->headline ) > 0 ); $caption_exists = ( strlen( $args->caption ) > 0 ); if ( !$headline_exists && !$caption_exists ) { $args->headline = __( 'Wow!', 'bpq' ); $args->caption = __( 'Grab your visitors\' attention with this fantastic site-wide alarm!', 'bpq' ); $headline_exists = $caption_exists = true; } // Process the headline and caption so we do not get raw markup displayed to the end-user. $content .= ''.html_entity_decode( $args->headline ).''; if ( $headline_exists && $caption_exists ) $content .= ' '.$args->delimiter.' '; $content .= html_entity_decode( $args->caption ); // Ensure that the class gets the given purpose/color // and alignment. $class .= ' '.$args->purpose_class; $class .= ' '.$args->align_class; // The markup. return apply_filters( 'filter_bpq_area_alarm_before', '' ). '
'. apply_filters( 'filter_bpq_area_alarm_start', '' ). '
'. $content. '
'. apply_filters( 'filter_bpq_area_alarm_end', '' ). '
'. apply_filters( 'filter_bpq_area_alarm_after', '' ); } /** * Generates a top bar that typically sits above the masthead. * * @param array $args Can be any of the following arguments: * string $span_class Can be Bootstrap's 'container' or 'container-fluid' * string $align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * @return string The generated markup */ function tag_top( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'span_class' => 'container-fluid', 'align_class' => 'mc' ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class = ''; $content = ''; // The caller must supply the Bootstrap boxing container and alignment. $class .= ' '.$args->span_class; $class .= ' '.$args->align_class; // There is simply a single widgetized area here. ob_start(); if ( !dynamic_sidebar( 'top-1' ) ) { echo '
'. sprintf( __( 'This is a top bar, you can change the display of this section '. 'in the BluePrint-Q Customizer.', 'bpq' ), ( ( ( BPQ_EDITION >= 2 ) || ( current_user_can( 'edit_theme_options' ) ) ) ? admin_url( 'customize.php' ) : '#' ) //WP-DIR ). '
'; } $content .= ob_get_clean(); // The markup; repeat content twice - once for a regular desktop // layout and another time for a mobile collapsed layout. return apply_filters( 'filter_bpq_area_top_before', '' ). '
'. apply_filters( 'filter_bpq_area_top_start', '' ). ''. '
'. $content. '
'. '
'. $content. '
'. apply_filters( 'filter_bpq_area_top_end', '' ). '
'. apply_filters( 'filter_bpq_area_top_after', '' ); } /** * Generates a prominent area where the logo or title/tagline can be displayed. * * @param array $args Can be any of the following arguments: * string $span_class Can be Bootstrap's 'container' or 'container-fluid' * string $purpose Can be 'image' or 'text'; helps influence which other arguments are respected * string $title Typically the site's title; respected if $purpose is 'text' * string $subtitle Typically the site's tagline; respected if $purpose is 'text' * integer $image_id The ID of the image to display; respected if $purpose is 'image' * boolean $use_widgets Setting to 'true' splits the masthead in half using the associated sidebar on the right-half * boolean $single_line Set to 'true' to keep title and tagline on the same line; otherwise, tagline appears below title * boolean $hide_mobile Set to 'true' if you do not want the masthead to appear on small screens * @return string The generated markup */ function tag_masthead( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'span_class' => 'container-fluid', 'purpose' => 'text', 'title' => '', 'subtitle' => '', 'image_id' => 0, 'use_widgets' => false, 'single_line' => false, 'hide_mobile' => false ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class = ''; $class_widget = ''; $content = ''; $content_widget = ''; // The caller must supply the Bootstrap boxing container and alignment. $class .= ' '.$args->span_class; // A masthead might not look right on mobile, so respect that. if ( $args->hide_mobile ) $class .= ' desktop'; // If desired, create a second half to the masthead with the widgets. $col_span = $args->use_widgets ? 6 : 12; if ( $args->use_widgets ) { ob_start(); echo '
'; dynamic_sidebar( 'masthead-1' ); echo '
'; $content_widget .= ob_get_clean(); } // Draw up different markup based on the purpose. $align = ( $args->use_widgets ) ? 'ml' : 'mc'; $content .= '
'; if ( $args->purpose == 'image' ) { // If a legit ID was given, search for the image data. $image_src = ''; $image_alt = ''; $image_meta = \ski\media::get_meta_info( $args->image_id ); if ( !empty( $image_meta ) ) { $image_src = $image_meta['src']; $image_alt = $image_meta['alt']; } if ( !empty( $image_src ) ) { $content .= ''. ''.$image_alt.''. ''; } } elseif ( $args->purpose == 'text' ) { // Wrap the title and tagline in a Bootstrap

combo. if ( !empty( $args->title ) || !empty( $args->subtitle ) ) { // Layout is a bit different based on if the single or double lines. $break = ''; $class_break = 'oneline'; if ( !$args->single_line ) { if ( !empty( $args->title ) && !empty( $args->subtitle ) ) $break = '
'; $class_break = 'twoline'; } if ( !empty( $args->subtitle ) ) $args->subtitle = ''.$args->subtitle.''; $content .= ''. '

'. $args->title. $break. $args->subtitle. '

'. '
'; } } $content .= '

'; // The markup. return apply_filters( 'filter_bpq_area_masthead_before', '' ). '
'. apply_filters( 'filter_bpq_area_masthead_start', '' ). '
'. '
'. $content. $content_widget. '
'. '
'. apply_filters( 'filter_bpq_area_masthead_end', '' ). '
'. apply_filters( 'filter_bpq_area_masthead_after', '' ); } /** * Generates a navbar, usually below the masthead/logo section. * * @link http://getbootstrap.com/components/#navbar * @param array $args Can be any of the following arguments: * string $span_class Can be Bootstrap's 'container' or 'container-fluid' * string $brand_purpose Can be 'logo' or 'text'; helps influence which other brand arguments are respected * string $brand_text Plain text to display; respected if $brand_purpose is 'text' * integer $brand_logo_id The ID of an image to display; respected if $brand_purpose is 'logo' * string $brand_logo_offset The vertical offset of the brand logo; only respected if $brand is an image * string $menu_id The ID of the menu to display * boolean $show_cart Set to 'true' to display a button on the navbar for the shopping cart * boolean $show_login Set to 'true' to display a button on the navbar for the login screen * boolean $show_search Set to 'true' to display a button on the navbar that contains a search form * string $scheme Can be 'navbar-default' or 'navbar-inverse' (soon to come - 'tone') * boolean $animate Determines whether the navbar executes animations * boolean $hide_mobile Set to 'true' if you do not want the masthead to appear on small screens * @return string The generated markup */ function tag_navigation( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'span_class' => 'container-fluid', 'brand_purpose' => 'logo', 'brand_text' => '', 'brand_logo_id' => 0, 'brand_logo_offset' => 0, 'menu_id' => 0, 'show_cart' => false, 'show_login' => false, 'show_search' => false, 'scheme' => 'navbar-default', 'animate' => true, 'hide_mobile' => false ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class = ''; $class_navbar = ''; $class_hide_mobile = ''; $content = ''; $content_brand = ''; $content_cart = ''; $content_login = ''; $content_search = ''; // The caller must supply the Bootstrap boxing container and the scheme that // indicates whether the colors will follow Bootstrap or BluePrint-Q tones. $class .= $args->span_class; $class_navbar .= ' '.$args->scheme; $class_navbar .= ' '.( \ski\convert::to_boolean( $args->animate ) ? 'animate' : '' ); // The brand might not look right on mobile along with a masthead that could // have some sort of repetitive logo, so respect that. if ( $args->hide_mobile ) $class_hide_mobile .= ' desktop'; // Construct the menu that was selected. if ( !empty( $args->menu_id ) ) { $menu_args = array ( 'menu' => $args->menu_id, 'container' => false, 'menu_class' => 'nav navbar-nav navbar-left', 'echo' => false, 'fallback_cb' => false, 'depth' => 2, 'walker' => new walker_nav() ); $content .= wp_nav_menu( $menu_args ); } // Or if no menu was selected, then show some defaults. else { $default_menu = ''; $content .= $default_menu; } // Give an opportunity to alter the calculated menu. $content = apply_filters( 'filter_bpq_main_menu', $content ); // Look at the brand as an image. if ( $args->brand_purpose == 'logo' ) { // Try searching for the image data based on the given ID. $brand_src = ''; $brand_alt = ''; $brand_meta = \ski\media::get_meta_info( $args->brand_logo_id ); if ( !empty( $brand_meta ) ) { $brand_src = $brand_meta['src']; $brand_alt = $brand_meta['alt']; } // No meta, so use the default BPQ logo. else { // Note: Special case for when no options are found - display the BPQ logo as filler. $brand_src = get_template_directory_uri().'/assets/logos/logo-symbol.png'; $args->brand_logo_offset = -25; } // Only construct the markup if there is an image to display. if ( !empty( $brand_src ) ) { $content_brand .= ''; } } // Or look at the brand as plain text. else if ( $args->brand_purpose == 'text' ) { // Only construct the markup if there is text to display. if ( !empty( $args->brand_text ) ) { $content_brand .= ''. $args->brand_text. ''; } } if ( $args->show_cart ) { $content_cart .= '
  • '. ''. ''. ''.__( 'Cart', 'bpq' ).''. ''. '
  • '; } if ( $args->show_login ) { $content_login .= '
  • '. ''. ''. ''.__( 'Login', 'bpq' ).''. ''. '
  • '; } if ( $args->show_search ) { $content_search .= ''; } // The navbar is a huge piece of markup. return apply_filters( 'filter_bpq_area_navigation_before', '' ). '
    '. apply_filters( 'filter_bpq_area_navigation_start', '' ). ''. apply_filters( 'filter_bpq_area_navigation_end', '' ). '
    '. apply_filters( 'filter_bpq_area_navigation_after', '' ); } /** * Generates the markup for any potential sidebars to the left of the main content. * * @param array $args Can be any of the following arguments: * string $sidebar_align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * string $sidebar_layout Can be '0', 'l1', 'l2', '11r1', 'r2', or 'r1' * integer $sidebar_size The number of columns that each sidebar takes up in a 12-column grid * boolean $hide_mobile Set to 'true' if you do not want the sidebar to appear on small screens * @return string The generated markup */ function tag_sidebars_left( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'sidebar_align_class' => 'ml', 'sidebar_layout' => '0', 'sidebar_size' => 3, 'hide_mobile' => false, ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class_col_sidebar = ' area-sidebar left-sidebar'; $content = ''; // The caller must supply the alignments. $class_col_sidebar .= ' '.$args->sidebar_align_class; // A sidebar might not look right on mobile, so respect that. if ( $args->hide_mobile ) $class_col_sidebar .= ' desktop'; // Determine the number of sidebars and some class info for // grid among the potential sidebars and content area. $num_sidebars = convert_symbol_sidebar_layout( $args->sidebar_layout ); $class_col_sidebar .= ' col-md-'.( ( $num_sidebars > 0 ) ? $args->sidebar_size : 0 ); // Draw up the divs that contain the potential sidebars. ob_start(); if ( in_array( $args->sidebar_layout, array( 'l1', 'l2', 'l1r1' ) ) ) { echo apply_filters( 'filter_bpq_area_sidebars_before', '' ). ''. apply_filters( 'filter_bpq_area_sidebars_after', '' ); } if ( in_array( $args->sidebar_layout, array( 'l2' ) ) ) { echo apply_filters( 'filter_bpq_area_sidebars_before', '' ). ''. apply_filters( 'filter_bpq_area_sidebars_after', '' ); } $content .= ob_get_clean(); // The markup. return $content; } /** * Generates the starting markup that surrounds article content. * * Note: This function only makes sense to use if you follow it up * with a call to tag_article_scaffolding_right. * * @param array $args Can be any of the following arguments: * string $content_align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * string $sidebar_layout Can be '0', 'l1', 'l2', '11r1', 'r2', or 'r1' * integer $sidebar_size The number of columns that each sidebar takes up in a 12-column grid * @return string The generated markup */ function tag_article_scaffolding_left( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'content_align_class' => 'ml', 'sidebar_layout' => '0', 'sidebar_size' => 3, ); $args = (object)wp_parse_args( $args, $defaults ); // The caller must supply the alignments. $class_col_content = ' '.$args->content_align_class; // Determine the number of sidebars and some class info for // grid among the potential sidebars and content area. $num_sidebars = convert_symbol_sidebar_layout( $args->sidebar_layout ); $class_col_content .= ' col-md-'.( 12 - ( $args->sidebar_size * $num_sidebars ) ); // Note: Not closing the
    tag is intentional - you MUST pair up // this function with a call to the 'scaffolding_right' version. return apply_filters( 'filter_bpq_area_content_before', '' ). '
    '. apply_filters( 'filter_bpq_area_content_start', '' ); } /** * Generates the ending markup that surrounds article content. * * Note: This function only makes sense to use if you precede it * with a call to tag_article_scaffolding_left. * * @param array $args Can be any of the following arguments: * TBD * @return string The generated markup */ function tag_article_scaffolding_right( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); // Note: Not opening the
    tag is intentional - you MUST pair up // this function with a call to the 'scaffolding_left' version. return apply_filters( 'filter_bpq_area_content_end', '' ). '
    '. apply_filters( 'filter_bpq_area_content_after', '' ); } /** * Generates the markup for any potential sidebars to the right of the main content. * * @param array $args Can be any of the following arguments: * string $sidebar_align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * string $sidebar_layout Can be '0', 'l1', 'l2', '11r1', 'r2', or 'r1' * integer $sidebar_size The number of columns that each sidebar takes up in a 12-column grid * boolean $hide_mobile Set to 'true' if you do not want the sidebar to appear on small screens * @return string The generated markup */ function tag_sidebars_right( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'sidebar_align_class' => 'ml', 'sidebar_layout' => '0', 'sidebar_size' => 3, 'hide_mobile' => false, ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class_col_sidebar = ' area-sidebar right-sidebar'; $content = ''; // The caller must supply the alignment. $class_col_sidebar .= ' '.$args->sidebar_align_class; // A sidebar might not look right on mobile, so respect that. if ( $args->hide_mobile ) $class_col_sidebar .= ' desktop'; // Determine the number of sidebars and some class info for // grid among the potential sidebars and content area. $num_sidebars = convert_symbol_sidebar_layout( $args->sidebar_layout ); $class_col_sidebar .= ' col-md-'.( ( $num_sidebars > 0 ) ? $args->sidebar_size : 0 ); // Draw up the divs that contain the potential sidebars. ob_start(); if ( in_array( $args->sidebar_layout, array( 'r1', 'r2' ) ) ) { echo apply_filters( 'filter_bpq_area_sidebars_before', '' ). ''. apply_filters( 'filter_bpq_area_sidebars_after', '' ); } if ( in_array( $args->sidebar_layout, array( 'l1r1', 'r2' ) ) ) { echo apply_filters( 'filter_bpq_area_sidebars_before', '' ). ''. apply_filters( 'filter_bpq_area_sidebars_after', '' ); } $content .= ob_get_clean(); // The markup. return $content; } /** * Generates a footer/widget area. * * @param array $args Can be any of the following arguments: * string $span_class Can be Bootstrap's 'container' or 'container-fluid' * string $align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * integer $num_pedestals Can be 1, 2, 3, 4, or 6 widgetized areas going across * @return string The generated markup */ function tag_pedestal( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'span_class' => 'container-fluid', 'align_class' => 'mc', 'num_pedestals' => 0 ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class = ''; $class_col = ''; $content = ''; // The caller must supply the Bootstrap boxing container. $class .= ' '.$args->span_class; // Split the widgets evenly and give each its own alignment. $class_col .= ' '.$args->align_class; $class_col .= ' '.\ski\bootstrap::convert_to_equal_grid_columns( $args->num_pedestals, 'md' ); // There is no 'get' variety of dynamic_sidebar, so we must use // the ob_ wrapper to redirect output and capture in $content. ob_start(); echo '
    '; for ( $i = 1; $i <= $args->num_pedestals; $i++ ) { $id = sprintf( 'pedestal-%d', $i ); echo '
    '; if ( !dynamic_sidebar( $id ) ) { echo '
    '. '
    '. '

    '.sprintf( __( 'Pedestal #%d', 'bpq' ), $i ).'

    '. '
    '. '

    '. __( 'Support up to six columns of unlimited widgets in this footer area. What will you display here?', 'bpq' ). '

    '. '
    '; } echo '
    '; } echo '
    '; $content .= ob_get_clean(); // The markup. return apply_filters( 'filter_bpq_area_pedestal_before', '' ). '
    '. apply_filters( 'filter_bpq_area_pedestal_start', '' ). '
    '. $content. '
    '. apply_filters( 'filter_bpq_area_pedestal_end', '' ). '
    '. apply_filters( 'filter_bpq_area_pedestal_after', '' ); } /** * Generates bottom bar that typically sits below the pedestal, * in the footer area. * * @param array $args Can be any of the following arguments: * string $span_class Can be Bootstrap's 'container' or 'container-fluid' * string $align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * @return string The generated markup */ function tag_bottom( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'span_class' => 'container-fluid', 'align_class' => 'mc' ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the option analysis. $class = ''; $content = ''; // The caller must supply the Bootstrap boxing container and alignment. $class .= ' '.$args->span_class; $class .= ' '.$args->align_class; // If in the architect version, then there is simply a // single widgetized area here. if ( BPQ_EDITION >= 2 ) { ob_start(); if ( !dynamic_sidebar( 'bottom-1' ) ) { echo '
    '. sprintf( __( 'This is a bottom bar, you can change the display of this section '. 'in the BluePrint-Q Customizer.', 'bpq' ), admin_url( 'customize.php' ) ). '
    '; } $content .= ob_get_clean(); } // Otherwise, if any other version, then force a // credit for BluePrint-Q. else { // Note: Fake a widget class here for consistent spacing. $content .= sprintf( __( '
    '. 'WordPress theme provided by BluePrint-Q '. 'Innovative Solutions. Build your website today!'. '
    ', 'bpq' ), welcome::url() ); } // The markup; repeat content twice - once for a regular desktop // layout and another time for a mobile collapsed layout. return apply_filters( 'filter_bpq_area_bottom_before', '' ). '
    '. apply_filters( 'filter_bpq_area_bottom_start', '' ). '
    '. $content. '
    '. apply_filters( 'filter_bpq_area_bottom_end', '' ). '
    '. apply_filters( 'filter_bpq_area_bottom_after', '' ); } ?>