' . get_the_author() . '' ); // Finally, let's write all of this to the page. echo '' . abnomize_time_link() . ' ' . $byline . ''; } endif; if ( ! function_exists( 'abnomize_time_link' ) ) : /** * Gets a nicely formatted string for the published date. */ function abnomize_time_link() { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, get_the_date( DATE_W3C ), get_the_date(), get_the_modified_date( DATE_W3C ), get_the_modified_date() ); // Wrap the time string in a link, and preface it with 'Posted on'. return sprintf( /* translators: %s: post date */ __( 'Posted on %s', 'abnomize' ), '' . $time_string . '' ); } endif; if ( ! function_exists( 'abnomize_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function abnomize_entry_footer() { /* translators: used between list items, there is a space after the comma */ $separate_meta = __( ', ', 'abnomize' ); // Get Categories for posts. $categories_list = get_the_category_list( $separate_meta ); // Get Tags for posts. $tags_list = get_the_tag_list( '', $separate_meta ); if ( 'post' === get_post_type() ) { if ( $categories_list && abnomize_categorized_blog() ) { echo '' . __( 'Categories', 'abnomize' ) . '' . wp_kses_post($categories_list) . ''; } if ( $tags_list ) { echo '' . __( 'Tags', 'abnomize' ) . '' . wp_kses_post($tags_list) . ''; } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( 'Leave a comment', 'abnomize' ), esc_html__( '1 Comment', 'abnomize' ), esc_html__( '% Comments', 'abnomize' ) ); echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'abnomize' ), the_title( '"', '"', false ) ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function abnomize_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'abnomize_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( 'abnomize_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so abnomize_categorized_blog should return true. return true; } else { // This blog has only 1 category so abnomize_categorized_blog should return false. return false; } } /** * Flush out the transients used in abnomize_categorized_blog. */ function abnomize_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'abnomize_categories' ); } add_action( 'edit_category', 'abnomize_category_transient_flusher' ); add_action( 'save_post', 'abnomize_category_transient_flusher' ); if ( ! function_exists( 'abnomize_the_custom_logo' ) ) : /** * Displays the optional custom logo. */ function abnomize_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } endif;