max_num_pages < 2 ) { return; } ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> %s', __( 'Featured:', 'sapor' ) ); } $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 = '' . $time_string . ''; echo '' . $posted_on . ''; } endif; if ( ! function_exists( 'sapor_entry_meta' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function sapor_entry_meta() { // Hide category and tag text for pages. if ( 'post' == get_post_type() ) { if ( is_singular() && is_multi_author() ) { printf( '%1$s ' . __( 'by', 'sapor' ) . ' %3$s', _x( 'Author', 'By ', 'sapor' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( __( ', ', 'sapor' ) ); if ( $categories_list && sapor_categorized_blog() ) { printf( '' . __( 'Posted in %1$s', 'sapor' ) . '', $categories_list ); } } $format = get_post_format(); if ( current_theme_supports( 'post-formats', $format ) ) { printf( '%1$s' . __( 'Post format:', 'sapor' ) . ' %3$s', sprintf( '%s ', _x( 'Format', '', 'sapor' ) ), esc_url( get_post_format_link( $format ) ), get_post_format_string( $format ) ); } edit_post_link( __( 'Edit', 'sapor' ), '', '' ); if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( __( 'Leave a comment', 'sapor' ), __( '1 Comment', 'sapor' ), __( '% Comments', 'sapor' ) ); echo ''; } } endif; if ( ! function_exists( 'sapor_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function sapor_entry_footer() { // Hide category and tag text for pages. if ( 'post' == get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list(); if ( $tags_list && ! is_wp_error( $tags_list ) ) { printf( '', $tags_list ); } } } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function sapor_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'sapor_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 = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0; set_transient( 'sapor_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so sapor_categorized_blog should return true. return true; } else { // This blog has only 1 category so sapor_categorized_blog should return false. return false; } } if ( ! function_exists( 'sapor_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 Sapor 1.0 */ function sapor_post_thumbnail() { if ( post_password_required() || is_attachment() || ! sapor_has_post_thumbnail() ) { return; } if ( is_page() && ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?> %2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( '∞', 'sapor' ), '' . get_the_title( get_the_ID() ) . '' ) ); return ' ' . $link; } else { $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading %s', 'sapor' ), '' . get_the_title( get_the_ID() ) . '' ) ); return '… ' . $link; } } add_filter( 'excerpt_more', 'sapor_excerpt_more' ); endif; /** * Add a `screen-reader-text` class to the search form's submit button. * * @since Sapor 1.0 * * @param string $html Search form HTML. * @return string Modified search form HTML. */ function sapor_search_switch( $html ) { return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html ); } add_filter( 'get_search_form', 'sapor_search_switch' ); /** * Flush out the transients used in sapor_categorized_blog. */ function sapor_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'sapor_categories' ); } add_action( 'edit_category', 'sapor_category_transient_flusher' ); add_action( 'save_post', 'sapor_category_transient_flusher' );