' );
if ( $tags_list ) {
echo '' . __( 'Tags:', 'coral-parallax' ) . '' . $tags_list ;
}
} else {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'coral-parallax' ) );
if ( $categories_list && coral_parallax_categorized_blog() ) {
printf( '' . __( 'Categories: %1$s', 'coral-parallax' ) . '', $categories_list );
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'coral-parallax' ) );
if ( $tags_list ) {
printf( '' . __( 'Tags: %1$s', 'coral-parallax' ) . '', $tags_list );
}
}
}
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function coral_parallax_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'coral_parallax_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'coral_parallax_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so coral_parallax_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so coral_parallax_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in coral_parallax_categorized_blog.
*/
function coral_parallax_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'coral_parallax_categories' );
}
add_action( 'edit_category', 'coral_parallax_category_transient_flusher' );
add_action( 'save_post', 'coral_parallax_category_transient_flusher' );
if ( ! function_exists( 'coral_parallax_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* Create your own coral_parallax_post_thumbnail() function to override in a child theme.
*
*/
function coral_parallax_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>