. */
$attributes = ( !empty( $attr['id'] ) ? ' id="' . esc_attr( $attr['id'] ) . '"' : '' );
$attributes .= ' class="wp-caption ' . esc_attr( $attr['align'] ) . ' width-' . esc_attr( $width_class ) . '"';
$attributes .= ' style="width: ' . esc_attr( $attr['width'] ) . 'px"';
/* Open the caption
. */
$output = '
';
/* Allow shortcodes for the content the caption was created for. */
$output .= do_shortcode( $content );
/* Append the caption text. */
$output .= '
' . $attr['caption'] . '
';
/* Close the caption
. */
$output .= '
';
/* Return the formatted, clean caption. */
return $output;
}
add_filter( 'img_caption_shortcode', 'bosco_img_caption_shortcode', 10, 3 );
/**
* Filters the HTML containing the attachment that is prepended to the post to use
* the large image size (instead of the medium default).
*/
function bosco_prepend_attachment( $prepend ) {
$prepend = '
';
$prepend .= wp_get_attachment_link(0, 'large', false);
$prepend .= '
';
return $prepend;
}
add_filter( 'prepend_attachment', 'bosco_prepend_attachment' );
/**
* Sets the authordata global when viewing an author archive.
*
* This provides backwards compatibility with
* http://core.trac.wordpress.org/changeset/25574
*
* It removes the need to call the_post() and rewind_posts() in an author
* template to print information about the author.
*
* @global WP_Query $wp_query WordPress Query object.
* @return void
*/
function bosco_setup_author() {
global $wp_query;
if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'bosco_setup_author' );
/**
* Returns true if a blog has more than 1 category.
*/
function bosco_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'hide_empty' => 1,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0;
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
}
if ( '1' != $all_the_cool_cats ) {
// This blog has more than 1 category so bosco_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so bosco_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in bosco_categorized_blog.
*/
function bosco_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'all_the_cool_cats' );
}
add_action( 'edit_category', 'bosco_category_transient_flusher' );
add_action( 'save_post', 'bosco_category_transient_flusher' );
/**
* Change the Eventbrite event meta separator to a bullet.
*/
function bosco_filter_meta_separator() {
return '
• ';
}
add_filter( 'eventbrite_meta_separator', 'bosco_filter_meta_separator' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Jetpack setup
*/
require get_template_directory() . '/inc/jetpack.php';