', '' );
}
}
}
endif;
if ( ! function_exists( 'corporately_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function corporately_entry_footer() {
global $post;
// Hide category and tag text for pages.
if ( 'post' === get_post_type() || 'jetpack-portfolio' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
if( 'post' === get_post_type() ) {
$categories_list = get_the_category_list( esc_html__( ', ', 'corporately' ) );
} elseif( 'jetpack-portfolio' === get_post_type() ) {
$categories_list = get_the_term_list( $post->ID, 'jetpack-portfolio-type', '', esc_html_x(', ', 'Used between list items, there is a space after the comma.', 'corporately' ), '');
}
if ( $categories_list && corporately_categorized_blog() ) {
printf( '' . $categories_list . '', $categories_list ); // WPCS: XSS OK.
}
/* translators: used between list items, there is a space after the comma */
if ( 'post' === get_post_type() ) {
$tags_list = get_the_tag_list( '
'; // WPCS: XSS OK.
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
comments_popup_link( esc_html__( 'Leave a comment', 'corporately' ), esc_html__( '1 Comment', 'corporately' ), esc_html__( '% Comments', 'corporately' ) );
echo '';
}
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function corporately_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'corporately_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( 'corporately_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so corporately_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so corporately_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in corporately_categorized_blog.
*/
function corporately_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'corporately_categories' );
}
add_action( 'edit_category', 'corporately_category_transient_flusher' );
add_action( 'save_post', 'corporately_category_transient_flusher' );
/*==============================================================================
* corporately CUSTOM TAGS BELOW
=============================================================================*/
/**
* Fancy excerpts
*
* @link: http://wptheming.com/2015/01/excerpt-versus-content-for-archives/
*/
function corporately_fancy_excerpt() {
global $post;
if( is_archive() ) {
the_excerpt();
echo '