%2$s',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( __( 'Continue reading "%s"', 'smerk' ), get_the_title( get_the_ID() ) )
);
return ' … ' . $link;
}
add_filter( 'excerpt_more', 'smerk_excerpt_more' );
endif;
/**
* Determines whether blog/site has more than one category.
*
* Create your own smerk_categorized_blog() function to override in a child theme.
*
* @since Smerk 1.0
*
* @return bool True if there is more than one category, false otherwise.
*/
function smerk_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'smerk_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
// 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( 'smerk_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so smerk_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so smerk_categorized_blog should return false.
return false;
}
}
/**
* Flushes out the transients used in smerk_categorized_blog().
*
* @since Smerk 1.0
*/
function smerk_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'smerk_categories' );
}
add_action( 'edit_category', 'smerk_category_transient_flusher' );
add_action( 'save_post', 'smerk_category_transient_flusher' );
if ( ! function_exists( 'smerk_the_custom_logo' ) ) :
/**
* Displays the optional custom logo.
*
* Does nothing if the custom logo is not available.
*
* @since Smerk 1.0
*/
function smerk_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;