get( 'Version' ); } endif; /*------------------------------------------------------------ Prints HTML with date information for current post ============================================================*/ if ( ! function_exists( 'blogolife_entry_date' ) ) : function blogolife_entry_date() { $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' ) ), get_the_date(), esc_attr( get_the_modified_date( 'c' ) ), get_the_modified_date() ); printf( '%2$s', esc_url( get_permalink() ), $time_string ); } endif; /*------------------------------------------------------------ Prints HTML with Author Name information for current post ============================================================*/ if ( ! function_exists( 'blogolife_entry_author' ) ) : function blogolife_entry_author() { $author_avatar_size = apply_filters( 'blogolife_author_avatar_size', 20 ); printf( '%1$s %3$s', get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } endif; /*------------------------------------------------------------ Prints HTML for post comments ============================================================*/ if ( ! function_exists( 'blogolife_entry_comments' ) ) : function blogolife_entry_comments() { if ( ! is_singular() && ! post_password_required() && ( comments_open() ) ) { echo ''; comments_popup_link( __( 'Add a Comment', 'blogolife' ), __( '1 Comment', 'blogolife' ), __( '% Comments', 'blogolife' ), 'comments_popup_link', __( 'Comments are closed', 'blogolife' ) ); echo ''; } } endif; /*------------------------------------------------------------ Prints HTML with category for current post. ============================================================*/ if ( ! function_exists( 'blogolife_entry_taxonomies_categories' ) ) : function blogolife_entry_taxonomies_categories() { $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'blogolife' ) ); if ( $categories_list && blogolife_categorized_blog() ) { printf( '', _x( 'Categories:', 'Used before category names.', 'blogolife' ), $categories_list ); } } endif; /*------------------------------------------------------------ Prints HTML with tags for current post. ============================================================*/ if ( ! function_exists( 'blogolife_entry_taxonomies_tags' ) ) : function blogolife_entry_taxonomies_tags() { $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'blogolife' ) ); if ( $tags_list ) { printf( '', _x( 'Tags:', 'Used before tag names.', 'blogolife' ), $tags_list ); } } endif; /*------------------------------------------------------------ Determines whether blog/site has more than one category. ============================================================*/ if ( ! function_exists( 'blogolife_categorized_blog' ) ) : function blogolife_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'blogolife_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( 'blogolife_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so blogolife_categorized_blog should return true. return true; } else { // This blog has only 1 category so blogolife_categorized_blog should return false. return false; } } endif; /*------------------------------------------------------------ Flushes out the transients used in blogolife_categorized_blog(). ============================================================*/ function blogolife_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'blogolife_categories' ); } add_action( 'edit_category', 'blogolife_category_transient_flusher' ); add_action( 'save_post', 'blogolife_category_transient_flusher' ); /*------------------------------------------------------------ Flushes out the transients for Latest Comments and Popular Posts ============================================================*/ function blogolife_lcp_popular_lcomments_transient_flusher( $comment_ID, $comment_approved ) { if( 1 === $comment_approved ){ delete_transient( 'blogolife_popular_posts' ); delete_transient( 'blogolife_latest_comments' ); } } function blogolife_lcp_popular_lcomments_transient_flushert ($comment_ID) { delete_transient( 'blogolife_popular_posts' ); delete_transient( 'blogolife_latest_comments' ); } add_action ( 'comment_post', 'blogolife_lcp_popular_lcomments_transient_flusher', 10, 2 ); add_action ( 'trashed_comment', 'blogolife_lcp_popular_lcomments_transient_flushert' ); add_action ( 'untrashed_comment', 'blogolife_lcp_popular_lcomments_transient_flushert' ); add_action ( 'deleted_comment', 'blogolife_lcp_popular_lcomments_transient_flushert' ); /*------------------------------------------------------------ Flushes out the transients for Latest Posts ============================================================*/ function blogolife_lcp_latest_posts_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } delete_transient( 'blogolife_latest_posts' ); } add_action( 'save_post', 'blogolife_lcp_latest_posts_transient_flusher' ); /*------------------------------------------------------------ Add CSS class to menus for submenu indicator ============================================================*/ class Blogolife_Walker_Mobile_Menu extends Walker_Nav_Menu { function start_lvl(&$output, $depth = 0, $args = Array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent