' . esc_attr( get_the_title() ) . ''; if ( 'post' === get_post_type() ) { ?>
' . get_the_archive_title() . ''; } elseif ( is_search() ) { echo '

' . sprintf( esc_html__( 'Search Results for: %s', 'satu' ), '' . get_search_query() . '' ) . '

'; } elseif ( is_404() ) { echo '

' . esc_html__( 'Oops! That page can’t be found.', 'satu' ) . '

'; } else { echo '

'; } } endif; if ( ! function_exists( 'satu_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function satu_posted_on() { $time_string = ''; 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( 'Posted on %s', 'post date', 'satu' ), '' . $time_string . '' ); // Get author ID $id = get_the_author_meta( 'ID' ); if ( ! in_the_loop() ) { $id = get_queried_object()->post_author; } $byline = sprintf( esc_html_x( 'by %s', 'post author', 'satu' ), '' . esc_html( get_the_author_meta( 'display_name', $id ) ) . '' ); echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK. } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function satu_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'satu_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( 'satu_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so satu_categorized_blog should return true. return true; } else { // This blog has only 1 category so satu_categorized_blog should return false. return false; } } /** * Flush out the transients used in satu_categorized_blog. */ function satu_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'satu_categories' ); } add_action( 'edit_category', 'satu_category_transient_flusher' ); add_action( 'save_post', 'satu_category_transient_flusher' );