max_num_pages; } // Don't print empty markup if there's only one page. if ( $max_num_pages < 2 ) { return; } ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> 1, ) ); // Count the number of categories that are attached to the posts $all_the_cool_cats = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0; set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so snaps_categorized_blog should return true return true; } else { // This blog has only 1 category so snaps_categorized_blog should return false return false; } } /** * Flush out the transients used in snaps_categorized_blog */ function snaps_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'snaps_category_transient_flusher' ); add_action( 'save_post', 'snaps_category_transient_flusher' ); if ( ! function_exists( 'snaps_entry_time_author' ) ) : /** * Displays post publish date and author */ function snaps_entry_time_author() { /* Get the published and update times */ $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() ) ); /* Print date together with author */ printf( __( ' %3$s by ', 'snaps' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), $time_string, esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'snaps' ), get_the_author() ) ), get_the_author() ); } endif; if ( ! function_exists( 'snaps_entry_meta' ) ) : /** * Displays meta information on posts */ function snaps_entry_meta() { if ( 'post' == get_post_type() ) { /* display published time and author */ snaps_entry_time_author(); /* Display categories and tags: */ /* translators: used between list items, there is a space after the comma */ $category_list = get_the_category_list( __( ', ', 'snaps' ) ); /* translators: used between list items, there is a space after the comma */ $tag_list = get_the_tag_list( '', __( ', ', 'snaps' ) ); $meta_text = null; if ( ! snaps_categorized_blog() ) { // This blog only has 1 category so we just need to worry about tags in the meta text if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'Tags: %2$s', 'snaps' ); } } else { // But this blog has loads of categories so we should probably display them here if ( '' != $tag_list && ! is_wp_error( $tag_list ) ) { $meta_text = __( 'Categories: %1$s', 'snaps' ); $meta_text .= __( 'Tags: %2$s', 'snaps' ); } else { $meta_text = __( 'Categories: %1$s', 'snaps' ); } } // end check for categories on this blog // If $tag_list has a WP Error, empty it before passing to printf(), just in case if ( is_wp_error( $tag_list ) ) { $tag_list = ''; } printf( $meta_text, $category_list, $tag_list, esc_url( get_permalink() ), the_title_attribute( 'echo=0' ) ); } } endif;