%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' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( esc_html_x( '%s', 'post date', 'artfolio' ), '' . __( $time_string, 'artfolio' ) . '' ); $byline = sprintf( esc_html_x( 'Written by %s', 'post author', 'artfolio' ), '' . esc_html( get_the_author() ) . '' ); echo ' ' . $byline . '' . $posted_on . '' . '
' . get_avatar( get_the_author_meta( 'ID' ) ) . '
'; // WPCS: XSS OK. } endif; if ( ! function_exists( 'artfolio_entry_footer' ) ) : /* * Prints HTML with meta information for the categories, tags and comments. */ function artfolio_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 */ $categories_list = get_the_category_list( esc_html__( ', ', 'artfolio' ) ); if ( $categories_list && artfolio_categorized_blog() ) { printf( '' . esc_html__( 'Posted in %1$s', 'artfolio' ) . '', $categories_list ); // WPCS: XSS OK. } /* * translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'artfolio' ) ); if ( $tags_list ) { printf( '' . esc_html__( 'Tagged %1$s', 'artfolio' ) . '', $tags_list ); // WPCS: XSS OK. } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; /* translators: %s: post title */ comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment on %s', 'artfolio' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) ); echo ''; } edit_post_link( sprintf( /* * translators: %s: Name of current post */ esc_html__( 'Edit %s', 'artfolio' ), the_title( '"', '"', false ) ), '', '' ); } endif; /* * Returns true if a blog has more than 1 category. * * @return bool */ function artfolio_categorized_blog() { $all_the_cool_cats = null; if ( false === ( $all_the_cool_cats = get_transient( 'artfolio_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( 'artfolio_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { /* * This blog has more than 1 category so artfolio_categorized_blog should return true */ return true; } else { /* * This blog has only 1 category so artfolio_categorized_blog should return false */ return false; } } /* * Flush out the transients used in artfolio_categorized_blog */ function artfolio_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'artfolio_categories' ); } add_action( 'edit_category', 'artfolio_category_transient_flusher' ); add_action( 'save_post', 'artfolio_category_transient_flusher' ); /* * Social media icon menu as per http://justintadlock.com/archives/2013/08/14/social-nav-menus-part-2 */ function artfolio_social_menu() { if ( has_nav_menu( 'social' ) ) { wp_nav_menu( array( 'theme_location' => 'social', 'container' => 'div', 'container_id' => 'menu-social', 'container_class' => 'menu-social', 'menu_id' => 'menu-social-items', 'menu_class' => 'menu-items', 'depth' => 1, 'link_before' => '', 'link_after' => '', 'fallback_cb' => '', ) ); } } /* * Landing menu */ function artfolio_landing_menu() { if ( has_nav_menu( 'landing' ) ) { wp_nav_menu( array( 'theme_location' => 'landing', 'container' => 'div', 'container_id' => 'menu-landing', 'container_class' => 'menu-landing', 'depth' => 1, 'fallback_cb' => '', ) ); } } /* * Display navigation to next/previous post when applicable. * * @return void */ function artfolio_post_navigation() { /* * Don't print empty markup if there's nowhere to navigate */ $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?>