'', 'caption' => '', 'purpose_class' => 'alert-info', 'align_class' => 'mc', 'is_dismissable' => true ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the parameters. $class = 'alert'; $content = ''; // If this alert 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 .= ''; } // Process the headline and caption so we do not get raw markup // displayed to the end-user; also, if there is no headline or // caption, it looks like Bootstrap requires a space. if ( strlen( $args->headline ) == 0 ) $args->headline = __( 'Wow!', 'bpq' ); else if ( empty( $args->headline ) ) $args->headline = ' '; $content .= ''.html_entity_decode( $args->headline ).' '; if ( strlen( $args->caption ) == 0 ) $args->caption = __( 'Grab your visitors\' attention with this fantastic site-wide alert bar!', 'bpq' ); else if ( empty( $args->caption ) ) $args->caption = ' '; $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 '
'. '
'. $content. '
'. '
'; } /** * 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 == 'bleed-narrow' ) ? 'container' : 'container-fluid'; $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 '
'. ''. '
'. $content. '
'. '
'. $content. '
'. '
'; } /** * Generates a prominent area where the logo or title/tagline can be displayed. * * @param array $args Can be any of the following arguments: * string $purpose Can be 'image' or 'text'; if text, then the title/tagline are displayed * string $span_class Can be Bootstrap's 'container' or 'container-fluid' * string $image URL of the image to display * boolean $hide_mobile Set to 'true' if you do not want the masthead to appear on small screens * boolean $use_widgets Setting to 'true' splits the masthead in half using the associated sidebar on the right-half * @return string The generated markup */ function tag_masthead( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'purpose' => 'text', 'span_class' => 'container-fluid', 'image_url' => '', 'hide_mobile' => false, 'use_widgets' => false, 'single_line' => 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 == 'bleed-narrow' ) ? 'container' : 'container-fluid'; // 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 an image was passed in, then prep it. $image_src = get_template_directory_uri().'/assets/filler/default-masthead.png'; if ( !empty( $args->image_url ) ) { $image_src = $args->image_url; if ( !\ski\string::starts_with( $image_src, 'http' ) ) $image_src = home_url().$image_src; } $content .= ''. ''. ''; } elseif ( $args->purpose == 'text' ) { // Wrap the title and tagline in a Bootstrap

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

'. $title. $break. $tagline. '

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

'; // The markup. return '
'. '
'. '
'. $content. $content_widget. '
'. '
'. '
'; } /** * 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' * boolean $hide_mobile Set to 'true' if you do not want the masthead to appear on small screens * string $brand_purpose Can be 'text' or 'logo' * string $brand_value Based on the $brand_purpose, can be interpretted as text or an image * string $offset The vertical offset of the brand logo; only respected if $brand is an image * string $menu A WP menu ID, name, or slug that identifies which menu gets baked into the navbar * 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 * @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', 'hide_mobile' => false, 'brand_purpose' => 'logo', 'brand_value' => '', 'offset' => 0, 'menu' => '', 'show_cart' => false, 'show_login' => false, 'show_search' => false, 'scheme' => 'navbar-default', 'animate' => true, ); $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 == 'bleed-narrow' ) ? 'container' : 'container-fluid'; $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 ( ( strlen( $args->menu ) > 0 ) && ( $args->menu != 'none' ) ) { $menu_args = array ( 'menu' => $args->menu, 'container' => false, 'menu_class' => 'nav navbar-nav', '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 = ''; if ( ( BPQ_EDITION >= 2 ) || ( current_user_can( 'edit_theme_options' ) ) ) //WP-DIR { $default_menu .= ''; } $content .= $default_menu; } // Give an opportunity to overwrite the calculated menu. $content = apply_filters( 'filter_bpq_change_main_menu', $content ); // If the brand is a file, then it is displayed as an image... if ( $args->brand_purpose == 'logo' ) { $brand_src = ( !\ski\string::starts_with( $args->brand_value, 'http' ) ) ? ( home_url().$args->brand_value ) : $args->brand_value; $brand_offset = $args->offset; if ( empty( $args->brand_value ) ) { // 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'; $brand_offset = -25; } $content_brand .= ''; } // ...Otherwise, it is to be displayed as plain text. else if ( !empty( $args->brand_value ) ) { $content_brand .= ''. $args->brand_value. ''; } 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 ''; } /** * 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 = ' 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 ''; } if ( in_array( $args->sidebar_layout, array( 'l2' ) ) ) { echo ''; } $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 '
    '; } /** * 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 '
    '; } /** * 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 = ' 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 ''; } if ( in_array( $args->sidebar_layout, array( 'l1r1', 'r2' ) ) ) { echo ''; } $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 == 'bleed-narrow' ) ? 'container' : 'container-fluid'; // 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++ ) //DAN-WOW: is the for-loop really smart enough to convert from string to int?? { $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 '
    '. '
    '. $content. '
    '. '
    '; } /** * 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 == 'bleed-narrow' ) ? 'container' : 'container-fluid'; $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 '
    '. '
    '. $content. '
    '. '
    '; } ?>