%2$s by %4$s ', get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ), _x( 'Author', 'Used before post author name.', 'smerk' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } $format = get_post_format(); if ( current_theme_supports( 'post-formats', $format ) ) { printf( '%1$s%3$s', sprintf( '%s ', _x( 'Format', 'Used before post format.', 'smerk' ) ), esc_url( get_post_format_link( $format ) ), get_post_format_string( $format ) ); } if ( 'post' === get_post_type() ) { smerk_entry_taxonomies(); } if ( ! is_singular() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( sprintf( __( 'Leave a comment on %s', 'smerk' ), get_the_title() ) ); echo ''; } } endif; if ( ! function_exists( 'smerk_paging_nav' ) ) : /** * Display navigation to next/previous set of posts when applicable. * * @since Smerk 1.0 * * @global WP_Query $wp_query WordPress Query object. * @global WP_Rewrite $wp_rewrite WordPress Rewrite object. */ function smerk_paging_nav() { global $wp_query, $wp_rewrite; // Don't print empty markup if there's only one page. if ( $wp_query->max_num_pages < 2 ) { return; } $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%'; // Set up paginated links. $links = paginate_links( array( 'base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map( 'urlencode', $query_args ), 'prev_text' => __( '← Previous', 'smerk' ), 'next_text' => __( 'Next →', 'smerk' ), ) ); if ( $links ) : ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> %2$s'; 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( '%1$s %3$s', _x( 'Posted on', 'Used before publish date.', 'smerk' ), esc_url( get_permalink() ), $time_string ); } endif; if ( ! function_exists( 'smerk_entry_taxonomies' ) ) : /** * Prints HTML with category and tags for current post. * * Create your own smerk_entry_taxonomies() function to override in a child theme. * * @since Smerk 1.0 */ function smerk_entry_taxonomies() { $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'smerk' ) ); if ( $categories_list && smerk_categorized_blog() ) { printf( '%1$s %2$s', _x( 'Categories', 'Used before category names.', 'smerk' ), $categories_list ); } $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'smerk' ) ); if ( $tags_list ) { printf( '%1$s %2$s', _x( 'Tags', 'Used before tag names.', 'smerk' ), $tags_list ); } } endif; if ( ! function_exists( 'smerk_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. * * Create your own smerk_post_thumbnail() function to override in a child theme. * * @since Smerk 1.0 */ function smerk_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading "%s"', 'smerk' ), get_the_title( get_the_ID() ) ) ); return ' … ' . $link; } add_filter( 'excerpt_more', 'smerk_excerpt_more' ); endif; /** * Determines whether blog/site has more than one category. * * Create your own smerk_categorized_blog() function to override in a child theme. * * @since Smerk 1.0 * * @return bool True if there is more than one category, false otherwise. */ function smerk_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'smerk_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( 'smerk_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so smerk_categorized_blog should return true. return true; } else { // This blog has only 1 category so smerk_categorized_blog should return false. return false; } } /** * Flushes out the transients used in smerk_categorized_blog(). * * @since Smerk 1.0 */ function smerk_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'smerk_categories' ); } add_action( 'edit_category', 'smerk_category_transient_flusher' ); add_action( 'save_post', 'smerk_category_transient_flusher' ); if ( ! function_exists( 'smerk_the_custom_logo' ) ) : /** * Displays the optional custom logo. * * Does nothing if the custom logo is not available. * * @since Smerk 1.0 */ function smerk_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } endif;