%3$s%4$s',
esc_url( get_permalink() ),
esc_attr( get_the_date() ),
esc_html( get_the_date( 'M' ) ),
esc_html( get_the_date( 'j' ) )
);
}
endif;
function bouquet_post_meta() {
if ( is_singular() ) :
/* translators: used between list items, there is a space after the comma */
$category_list = get_the_category_list( __( ', ', 'bouquet' ) );
/* translators: used between list items, there is a space after the comma */
$tag_list = get_the_tag_list( '', esc_html__( ', ', 'bouquet' ) );
if ( ! bouquet_categorized_blog() ) {
// This blog only has 1 category so we just need to worry about tags in the meta text
if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) {
$meta_text = __( 'This entry was posted on %5$s and tagged %2$s. Bookmark the permalink.', 'bouquet' );
} else {
$meta_text = __( 'This entry was posted on %5$s. Bookmark the permalink.', 'bouquet' );
}
} else {
// But this blog has loads of categories so we should probably display them here
if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) {
$meta_text = __( 'This entry was posted on %5$s, in %1$s and tagged %2$s. Bookmark the permalink.', 'bouquet' );
} else {
$meta_text = __( 'This entry was posted on %5$s, in %1$s. Bookmark the permalink.', 'bouquet' );
}
} // end check for categories on this blog
printf(
$meta_text,
$category_list,
$tag_list,
esc_url( get_permalink() ),
the_title_attribute( 'echo=0' ),
esc_attr( get_the_date() )
);
else :
/* translators: used between list items, there is a space after the comma */
$category_list = get_the_category_list( __( ', ', 'bouquet' ) );
/* translators: used between list items, there is a space after the comma */
$tag_list = get_the_tag_list( '', esc_html__( ', ', 'bouquet' ) );
if ( ! bouquet_categorized_blog() ) {
// This blog only has 1 category so we just need to worry about tags in the meta text
if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) {
$meta_text = __( 'This entry was posted on %3$s and tagged %2$s.', 'bouquet' );
} else {
$meta_text = __( 'This entry was posted on %3$s.', 'bouquet' );
}
} else {
// But this blog has loads of categories so we should probably display them here
if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) {
$meta_text = __( 'This entry was posted on %3$s, in %1$s and tagged %2$s.', 'bouquet' );
} else {
$meta_text = __( 'This entry was posted on %3$s, in %1$s.', 'bouquet' );
}
} // end check for categories on this blog
printf(
$meta_text,
$category_list,
$tag_list,
esc_attr( get_the_date() )
);
endif;
}
/**
* Add special classes to the WordPress body class.
*/
function bouquet_body_classes( $classes ) {
// If we have one sidebar active we have secondary content
if ( ! is_active_sidebar( 'sidebar-1' ) )
$classes[] = 'one-column';
return $classes;
}
add_filter( 'body_class', 'bouquet_body_classes' );
// Returns true if a blog has more than 1 category
function bouquet_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 bouquet_categorized_blog should return true
return true;
} else {
// This blog has only 1 category so bouquet_categorized_blog should return false
return false;
}
}
// Flush out the transients used in bouquet_categorized_blog
function bouquet_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'all_the_cool_cats' );
}
add_action( 'edit_category', 'bouquet_category_transient_flusher' );
add_action( 'save_post', 'bouquet_category_transient_flusher' );
// Filter in a link to a content ID attribute for the next/previous image links on image attachment pages
function bouquet_enhanced_image_navigation( $url ) {
global $wp_rewrite;
$id = (int) get_the_ID();
$object = get_post( $id );
if ( wp_attachment_is_image( $id ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) )
$url = $url . '#main';
return $url;
}
add_filter( 'attachment_link', 'bouquet_enhanced_image_navigation' );
// Enqueue font styles
function bouquet_fonts() {
wp_enqueue_style( 'sorts-mill-goudy', "https://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400" );
}
add_action( 'wp_enqueue_scripts', 'bouquet_fonts' );
/**
* Enqueue font style for the custom header admin page.
*/
function bouquet_admin_fonts( $hook_suffix ) {
if ( 'appearance_page_custom-header' != $hook_suffix )
return;
wp_enqueue_style( 'sorts-mill-goudy', "https://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400" );
}
add_action( 'admin_enqueue_scripts', 'bouquet_admin_fonts' );
function bouquet_header_css() {
// Hide the theme-provided background image if the user adds a custom background image or color
if ( '' != get_background_image() || '' != get_background_color() ) : ?>
tag based on what is being viewed.
*
* @since Bouquet 1.1
*/
function bouquet_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', 'bouquet' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'bouquet_wp_title', 10, 2 );
/**
* This theme has an options page that lets users pick layout, color scheme,
* featured post title text and configure a twitter icon.
*/
require get_template_directory() . '/inc/theme-options.php';
/**
* Load Jetpack compatibility file.
*/
if( class_exists( 'Jetpack' ) ) {
require get_template_directory() . '/inc/jetpack.compat.php';
}
/**
* This theme was built with PHP, Semantic HTML, CSS, love, a Toolbox, and flowers.
*/