',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$author = sprintf( '%3$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'adventurous' ), get_the_author() ) ),
get_the_author()
);
// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
$utility_text = __( 'Posted on %1$s by %2$s', 'adventurous' );
printf(
$utility_text,
$date,
$author
);
}
endif;
if ( ! function_exists( 'adventurous_footer_meta' ) ) :
/**
* Prints HTML with meta information for the normal post footer: date and author
*
* Create your own adventurous_footer_meta() to override in a child theme.
*
* @since Adventurous 1.0
*/
function adventurous_footer_meta() {
$utility_text = '';
// Translators: used between list items, there is a space after the comma.
$categories_list = get_the_category_list( __( ', ', 'adventurous' ) );
// Translators: used between list items, there is a space after the comma.
$tag_list = get_the_tag_list( '', __( ', ', 'adventurous' ) );
// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
if ( $tag_list ) {
$utility_text = __( 'Posted in %1$s | Tagged %2$s', 'adventurous' );
} elseif ( $categories_list ) {
$utility_text = __( 'Posted in %1$s', 'adventurous' );
}
if ( $utility_text ) {
printf(
$utility_text,
$categories_list,
$tag_list
);
}
}
endif;
if ( ! function_exists( 'adventurous_post_format_meta' ) ) :
/**
* Prints HTML with meta information for current post format: categories, tags, permalink, author, and date.
*
* Create your own adventurous_post_format_meta() to override in a child theme.
*
* @since Adventurous 1.0
*/
function adventurous_post_format_meta() {
// Translators: used between list items, there is a space after the comma.
$categories_list = get_the_category_list( __( ', ', 'adventurous' ) );
// Translators: used between list items, there is a space after the comma.
$tag_list = get_the_tag_list( '', __( ', ', 'adventurous' ) );
$date = sprintf( '',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$author = sprintf( '%3$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'adventurous' ), get_the_author() ) ),
get_the_author()
);
// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
if ( $tag_list ) {
$utility_text = __( 'Posted on %3$s under %1$s | Tagged %2$s | By %4$s', 'adventurous' );
} elseif ( $categories_list ) {
$utility_text = __( 'Posted on %3$s under in %1$s | By %4$s.', 'adventurous' );
} else {
$utility_text = __( 'Posted on %3$s | By %4$s.', 'adventurous' );
}
printf(
$utility_text,
$categories_list,
$tag_list,
$date,
$author
);
}
endif;
/**
* Returns true if a blog has more than 1 category
*
* @since Adventurous 1.0
*/
function adventurous_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 = count( $all_the_cool_cats );
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
}
if ( '1' != $all_the_cool_cats ) {
// This blog has more than 1 category so adventurous_categorized_blog should return true
return true;
} else {
// This blog has only 1 category so adventurous_categorized_blog should return false
return false;
}
}
/**
* Flush out the transients used in adventurous_categorized_blog
*
* @since Adventurous 1.0
*/
function adventurous_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'all_the_cool_cats' );
}
add_action( 'edit_category', 'adventurous_category_transient_flusher' );
add_action( 'save_post', 'adventurous_category_transient_flusher' );