'' ); $args = (object)wp_parse_args( $args, $defaults ); // Avoid pages with multiple entries - makes no sense. if ( is_front_page() || is_home() || is_archive() ) return ''; // Prepare the crumbs in an array. $levels = array(); $levels[] = ''.get_bloginfo( 'name' ).''; if ( is_category() || is_single() || is_attachment() ) $levels = array_merge( $levels, array_map( function( $el ) { return ''.$el->name.''; }, get_the_category() ) ); if ( is_single() || is_page() ) $levels[] = get_the_title(); // Glue the elements together into a single line - the array_filter // call automatically removes empty elements from being included. // // Note: The apparent-backwards
  • element pairing is intentional. return ''; } /** * Generates the markup that displays all comments for a given page/post. * * @link http://themeshaper.com/2012/11/04/the-wordpress-theme-comments-template/ * @param array $args Can be any of the following arguments: * TBD * @return string The markup */ function tag_comments( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); // Only show comments if there is a post or similar. global $post; if ( empty( $post ) ) return ''; // If comments are open or we have at least one comment, load up the comment template ob_start(); if ( comments_open() || '0' != get_comments_number() ) comments_template( '', true ); // Display it. return ob_get_clean(); } /** * Generates a prominent highlighted area associated with * the current post typically displays the post title * just above the post. * * @link http://getbootstrap.com/components/#alerts * @param array $args Can be any of the following arguments: * string $text The text to display * string $subtext The smaller text to display below the main text * string $align_class Can be 'ml', 'mc', or 'mr' for left, center, or right text alignment * string $context_class An optional descriptive class that is applied to the containers * @return string The generated markup */ function tag_highlight( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'text' => '', 'subtext' => '', 'align_class' => 'mc', 'context_class' => '', ); $args = (object)wp_parse_args( $args, $defaults ); // These get used in the markup based on the parameters. $class = ''; $content = ''; // The caller must supply the alignment. $class .= ' '.$args->align_class; // Filter. $args->text = apply_filters( 'filter_bpq_highlight_text', $args->text ); $args->subtext = apply_filters( 'filter_bpq_highlight_subtext', $args->subtext ); // Text. if ( empty( $args->text ) ) return ''; ob_start(); echo '

    '. $args->text; if ( !empty( $args->subtext ) ) { echo ''. '
    '. $args->subtext. '
    '. '
    '; } echo '

    '; $content .= ob_get_clean(); // The markup - wrap the content in a Bootstrap row to ensure // margins match up with the sidebar/content areas. return '
    '. ''. '
    '; } /** * Puts together the full "sha-bang" of metadata for posts. * * @link http://getbootstrap.com/components/#alerts * @param array $args Can be any of the following arguments: * boolean $include_author Send 'false' to omit this info * boolean $include_categories Send 'false' to omit this info * boolean $include_comments Send 'false' to omit this info * boolean $include_date Send 'false' to omit this info * boolean $include_tags Send 'false' to omit this info * string $date_archive_type Drive which date archive is linked to; can be: 'day', 'month', or 'year' * @return string The generated markup */ function tag_post_meta( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'include_author' => true, 'include_categories' => true, 'include_comments' => true, 'include_date' => true, 'include_tags' => true, 'date_archive_type' => 'month' ); $args = (object)wp_parse_args( $args, $defaults ); // Prepare an array of all the pieces that make up the post metadata. $meta = array(); if ( $args->include_author ) $meta[] = tag_post_meta_author(); if ( $args->include_categories ) $meta[] = tag_post_meta_categories(); if ( $args->include_comments ) $meta[] = tag_post_meta_comments(); if ( $args->include_date ) $meta[] = tag_post_meta_date( array( 'archive_type' => $args->date_archive_type ) ); if ( $args->include_tags ) $meta[] = tag_post_meta_tags(); // If no metadata was added to the overall array, then get // out now before return an empty element. if ( empty( $meta ) ) return ''; // Glue the elements together into a single line - the array_filter // call automatically removes empty elements from being included. return ''; } /** * Provides a link and info about the author who wrote a post. * * @link http://themeshaper.com/2012/11/01/the-wordpress-theme-index-template/ * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_post_meta_author( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); // Write up the date. ob_start(); echo ''. ''. ''. esc_html( get_the_author() ). ''. ''; // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_meta_author', ob_get_clean() ); } /** * Puts together a list of categories separated by commas. * * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_post_meta_categories( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); /* translators: used between list items, there is a space after the comma */ ob_start(); $categories_list = get_the_category_list( __( ', ', 'bpq' ) ); if ( $categories_list ) { echo ''. ''. sprintf( __( '%1$s', 'bpq' ), $categories_list ). ''; } // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_meta_categories', ob_get_clean() ); } /** * Provides a link to the comments while also informing how * many there are on the post. * * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_post_meta_comments( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); //DAN-HACK: Start // // The sample template in the Customizer should always show the comment // link - this is a hack because other post meta pieces handle the // sample template through filter hooks; unfortunately, there is no hook // for this post meta comment information. $comment_link = ''; if ( is_viewing_sample() ) $comment_link = ''.__( 'Comment', 'bpq' ).''; // //DAN-HACK: End // Consider a comments link - both informs and links to a place for leaving comments. elseif ( !post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { ob_start(); comments_popup_link( __( 'Leave a comment', 'bpq' ), __( '1 Comment', 'bpq' ), __( '% Comments', 'bpq' ) ); $comment_link = ob_get_clean(); } // Generate the markup. ob_start(); if ( !empty( $comment_link ) ) { echo ''. ''. $comment_link. ''; } // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_meta_comments', ob_get_clean() ); } /** * Provides a link and info about the date a post was posted. * * @link http://themeshaper.com/2012/11/01/the-wordpress-theme-index-template/ * @param array $args Can be any of the following arguments: * string $archive_type Drive which archive is linked to; can be: 'day', 'month', or 'year' * @return string The desired text */ function tag_post_meta_date( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'archive_type' => 'month' ); $args = (object)wp_parse_args( $args, $defaults ); // The date link could potentially go to // the daily, monthly, or yearly archives. $link = get_permalink(); switch ( $args->archive_type ) { case 'day': $link = get_day_link( get_post_time( 'Y' ), get_post_time( 'm' ), get_post_time( 'j' ) ); break; case 'month': $link = get_month_link( get_post_time( 'Y' ), get_post_time( 'm' ) ); break; case 'year': $link = get_year_link( get_post_time( 'Y' ) ); break; } // Write up the date. ob_start(); echo ''; // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_meta_date', ob_get_clean() ); } /** * Provides a link for any logged-in users who are permitted to edit posts. * * @link http://codex.wordpress.org/Template_Tags/get_edit_post_link * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_post_meta_edit( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); // Write up the date. ob_start(); echo ''. ''. ''. __( 'Edit', 'bpq' ). ''. ''; // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_meta_edit', ob_get_clean() ); } /** * Puts together a list of tags separated by commas. * * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_post_meta_tags( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); /* translators: used between list items, there is a space after the comma */ ob_start(); $tags_list = get_the_tag_list( '', __( ', ', 'bpq' ) ); if ( $tags_list ) { echo ''. ''. sprintf( __( '%1$s', 'bpq' ), $tags_list ). ''; } // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_meta_tags', ob_get_clean() ); } /** * Provides an icon that goes with a post layout. * * @param array $args Can be any of the following arguments: * string $icon If specified, will override the default icon; use full Font Awesome of Glyphicons markup * @return string The desired text */ function tag_post_icon( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'icon' => '' ); $args = (object)wp_parse_args( $args, $defaults ); // Write up the icon with font-awesome. return '
    '. ''. $args->icon. ''. '
    '; } /** * Retrieves, and optionally displays, the feature image from a post. * * @param array $args Can be any of the following arguments: * string $size One of the WP-defined image sizes: 'full', 'large', 'medium', or 'thumbnail' * @return string The desired image */ function tag_post_image( $args = array() ) { //DAN-HACK: Start // // Special case for the customizer sample template. if ( is_viewing_sample() ) { global $sample; return '
    '. $sample->post_thumbnail. '
    '; } // //DAN-HACK: End // Merge default arguments and the arguments supplied by the caller. $defaults = array( 'size' => 'thumbnail' ); $args = (object)wp_parse_args( $args, $defaults ); // Retrieve the image. ob_start(); if ( has_post_thumbnail() ) { echo '
    '; the_post_thumbnail( $args->size ); echo '
    '; } // Return the markup. return ob_get_clean(); } /** * Provides a linked version of the post title. * * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_post_title( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); // Write up the title using the various specialized WP functions. ob_start(); echo '

    '. ''. get_the_title(). ''. '

    '; // Display or not, then return. return ob_get_clean(); } /** * Provides a 'read more'-type link to the current post. * * @link http://codex.wordpress.org/Function_Reference/the_excerpt#Make_the_.22read_more.22_link_to_the_post * @param array $args Can be any of the following arguments: * TBD * @return string The desired text */ function tag_read_more( $args = array() ) { // Merge default arguments and the arguments supplied by the caller. $defaults = array( // TBD ); $args = (object)wp_parse_args( $args, $defaults ); // OPTION: Read more text $opt_text = get_theme_mod( 'bpq_opt_content_read_more_text', '' ); if ( empty( $opt_text ) ) $opt_text = __( 'continue reading', 'bpq' ); // Write up the read more link - note that the 'excerpt_more' // WP hook is being used for familiarity. ob_start(); echo ''. $opt_text. ' '. ''; // Ask the client if they want to change this up a bit (or ignore it completely). return apply_filters( 'filter_bpq_post_read_more', ob_get_clean() ); } ?>