%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() ) ); ?> ', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); ?> %2$s', esc_url( get_permalink() ), $time_string ); ?> %1$s %2$s', esc_html_x( 'Categories', 'Used before category names.', 'elemate' ), $categories_list ); } $tags_list = get_the_tag_list( '', esc_html_x( ', ', 'Used between list items, there is a space after the comma.', 'elemate' ) ); if ( $tags_list ) { printf( '', esc_html_x( 'Tags', 'Used before tag names.', 'elemate' ), $tags_list ); } } } if ( ! function_exists( 'elemate_edit_post_link' ) ) : /** * Prints the post's edit link */ function elemate_edit_post_link() { // Display 'edit' link. edit_post_link( sprintf( /* translators: %s: Name of current post */ __( 'Edit %s', 'elemate' ), the_title( '"', '"', false ) ), '', '' ); } endif; if ( ! function_exists( 'elemate_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function elemate_entry_footer() { /* translators: used between list items, there is a space after the comma */ $separate_meta = __( ', ', 'elemate' ); // Display Tags for posts. if ( 'post' === get_post_type() ) { $tags_list = get_the_tag_list( '', $separate_meta ); if ( $tags_list ) { printf( '', $tags_list ); // WPCS: XSS OK. } } // Display link to comments. if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( __( 'Leave a comment', 'elemate' ), __( '1 Comment', 'elemate' ), __( '% Comments', 'elemate' ) ); echo ''; } elemate_edit_post_link(); } endif; /** * Returns an accessibility-friendly link to edit a post or page. * * This also gives us a little context about what exactly we're editing * (post or page?) so that users understand a bit more where they are in terms * of the template hierarchy and their content. Helpful when/if the single-page * layout with multiple posts/pages shown gets confusing. * * @param int $id The post ID. */ function elemate_edit_link( $id ) { if ( is_page() ) { $type = __( 'Page', 'elemate' ); } elseif ( get_post( $id ) ) { $type = __( 'Post', 'elemate' ); } $link = edit_post_link( sprintf( // The translators: %s: Name of current post. __( 'Edit %1$s %2$s', 'elemate' ), $type, the_title( '"', '"', false ) ), '', '' ); return $link; } /** * Returns true if a blog has more than 1 category. * * @return bool */ function elemate_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'elemate_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( 'elemate_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so elemate_categorized_blog should return true. return true; } // This blog has only 1 category so elemate_categorized_blog should return false. return false; } /** * Flush out the transients used in elemate_categorized_blog. */ function elemate_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'elemate_categories' ); } add_action( 'edit_category', 'elemate_category_transient_flusher' ); add_action( 'save_post', 'elemate_category_transient_flusher' ); if ( ! function_exists( 'elemate_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 elemate_post_thumbnail() function to override in a child theme. * * @since Twenty Sixteen 1.0 */ function elemate_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) { ?>