%2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( esc_html_x( 'on %s', 'post date', 'avani' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'Written by %s', 'post author', 'avani' ), '' . esc_html( get_the_author() ) . '' ); echo ' ' . $byline . '' . $posted_on . ''; // WPCS: XSS OK. edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit Post%s', 'avani' ), the_title( '"', '"', false ) ), '', '' ); } endif; if ( ! function_exists( 'avani_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function avani_entry_footer() { // Hide category and tag text for pages. if ( is_singular( 'post' ) ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', 'avani' ) ); if ( $categories_list && avani_categorized_blog() ) { printf( '' . esc_html__( 'Posted in %1$s', 'avani' ) . '', $categories_list ); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'avani' ) ); if ( $tags_list ) { printf( '' . esc_html__( 'Tagged %1$s', 'avani' ) . '', $tags_list ); // WPCS: XSS OK. } } } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function avani_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'avani_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( 'avani_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so avani_categorized_blog should return true. return true; } else { // This blog has only 1 category so avani_categorized_blog should return false. return false; } } if ( ! function_exists( 'avani_the_custom_logo' ) ) : /** * Displays the optional custom logo. * * Does nothing if the custom logo is not available. */ function avani_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } endif; if ( ! function_exists( 'avani_the_custom_header' ) ) : /** * Displays the custom header. * * Does nothing if the custom header is not available. */ function avani_the_custom_header() { if ( get_header_image() ) { if ( 1 === get_theme_mod( 'avani_header_on_home_only', '' ) && ! ( is_home() || is_front_page() ) ) { return; } ?>
the_title_attribute( 'echo=0' ), 'class' => 'aligncenter thumbnails' ) ); ?>
' ); $i = 0; while ( $i < $total ) { $i++; if ( is_active_sidebar( 'footer-' . $i ) ) : printf( '' ); endif; } printf( '' ); } } endif; /** * Flush out the transients used in avani_categorized_blog. */ function avani_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'avani_categories' ); } add_action( 'edit_category', 'avani_category_transient_flusher' ); add_action( 'save_post', 'avani_category_transient_flusher' );