', false );
}
return $content;
}
add_filter( 'the_content', 'chunk_conditional_title', 0 );
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @since Chunk 1.1
*/
function chunk_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() )
return $title;
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title .= " $sep $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
$title .= " $sep " . sprintf( __( 'Page %s', 'chunk' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'chunk_wp_title', 10, 2 );
/**
* Get a short-form mime type for an audio file to display as a class attribute.
*
* @param int ID of an attachment
* @return string A short representation of the file's mime type.
*/
function chunk_post_classes( $classes ) {
if ( has_post_format( 'audio' ) ) {
$audio = chunk_audio_grabber( get_the_ID() );
if ( $audio ) {
$mime = str_replace( 'audio/', '', get_post_mime_type( $audio->ID ) );
if ( in_array( $mime, array( 'mp3', 'ogg', 'wav', ) ) )
$classes[] = $mime;
}
}
return $classes;
}
add_filter( 'post_class', 'chunk_post_classes' );
if ( ! function_exists( 'the_post_format_audio' ) ) :
/**
* Shiv for the_post_format_audio().
*
* the_post_format_audio() is part of a core plugin. To provide backward
* compatibility with previous versions, we will define our
* own version of this function.
*
* @param string $name The name of the shortcode.
* @return bool True if shortcode exists; False otherwise.
*/
function the_post_format_audio() {
$audio = chunk_audio_grabber( get_the_ID() );
if ( ! empty( $audio ) ) :
$url = wp_get_attachment_url( $audio->ID );
?>