max_num_pages < 2 ) { return; } // Set up paginated links. $links = paginate_links( array( 'prev_text' => esc_html__( 'Previous', 'twentyfifteen' ), 'next_text' => esc_html__( 'Next', 'twentyfifteen' ), 'before_page_number' => '' . esc_html__( 'Page', 'twentyfifteen' ) . '', ) ); if ( $links ) : ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ( ! $next && ! $previous ) || ( is_attachment() && 'attachment' == $previous->post_type ) ) { return; } $prev_class = $next_class = ''; if ( $previous && has_post_thumbnail( $previous->ID ) ) { $prev_class = ' has-post-thumbnail'; } if ( $next && has_post_thumbnail( $next->ID ) ) { $next_class = ' has-post-thumbnail'; } ?> 1 && get_option( 'page_comments' ) ) : ?> %s', esc_html__( 'Featured', 'twentyfifteen' ) ); } $format = get_post_format(); if ( current_theme_supports( 'post-formats', $format ) ) { printf( '%1$s%3$s', sprintf( '%s', esc_html_x( 'Format', 'Used before post format.', 'twentyfifteen' ) ), esc_url( get_post_format_link( $format ) ), get_post_format_string( $format ) ); } if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { $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() ) ); printf( '%1$s%3$s', sprintf( _x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ) ), esc_url( get_permalink() ), $time_string ); } if ( 'post' == get_post_type() ) { if ( is_singular() || is_multi_author() ) { printf( '%1$s%3$s', sprintf( _x( 'Author', 'Used before post author name.', 'twentyfifteen' ) ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); } $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); if ( $categories_list && twentyfifteen_categorized_blog() ) { printf( '%1$s%2$s', sprintf( _x( 'Categories', 'Used before category names.', 'twentyfifteen' ) ), $categories_list ); } $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); if ( $tags_list ) { printf( '%1$s%2$s', sprintf( _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ) ), $tags_list ); } } if ( is_attachment() && wp_attachment_is_image() ) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf( '%1$s%3$s × %4$s', sprintf( _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ) ), esc_url( wp_get_attachment_url() ), $metadata['width'], $metadata['height'] ); } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( 'Leave a comment', 'twentyfifteen' ), esc_html__( '1 Comment', 'twentyfifteen' ), esc_html__( '% Comments', 'twentyfifteen' ) ); echo ''; } } endif; /** * Returns true if a blog has more than 1 category. * * @since Twenty Fifteen 1.0 * * @return bool */ function twentyfifteen_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_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( 'twentyfifteen_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so twentyfifteen_categorized_blog should return true. return true; } else { // This blog has only 1 category so twentyfifteen_categorized_blog should return false. return false; } } /** * Flush out the transients used in twentyfifteen_categorized_blog. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'twentyfifteen_categories' ); } add_action( 'edit_category', 'twentyfifteen_category_transient_flusher' ); add_action( 'save_post', 'twentyfifteen_category_transient_flusher' ); if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) : /** * Display an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>