%2$s'; $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $post_date = sprintf( esc_html_x( '%s', 'post date', 'gaff-lite' ), '' . $time_string . '' ); $author = sprintf( esc_html_x( '%s', 'post author', 'gaff-lite' ), '' . esc_html( get_the_author() ) . '' ); // Print echo '
'; if ( is_single() ) { // Author and Date echo '
' . esc_html__( 'Author', 'gaff-lite' ) . '' . $author . '
'; echo '
' . esc_html__( 'Posted on', 'gaff-lite' ) . '' . $post_date . '
'; } else { // Date echo '' . $post_date . ''; } echo '
'; } endif; if ( ! function_exists( 'gaff_lite_print_post_meta_footer' ) ) : /** * Prints HTML with meta information for the categories, tags. * * @since 1.0.0 */ function gaff_lite_print_post_meta_footer() { // Do nothing for pages. if ( 'post' !== get_post_type() ) { return; } $tags_list = get_the_tag_list( '', '' ); if ( $tags_list ) { echo '
'; echo '
' . $tags_list . '
'; echo '
'; } } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function gaff_lite_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'gaff_lite_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( 'gaff_lite_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so gaff_lite_categorized_blog should return true. return true; } else { // This blog has only 1 category so gaff_lite_categorized_blog should return false. return false; } } /** * Flush out the transients used in gaff_lite_categorized_blog. */ function gaff_lite_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'gaff_lite_categories' ); } add_action( 'edit_category', 'gaff_lite_category_transient_flusher' ); add_action( 'save_post', 'gaff_lite_category_transient_flusher' ); if ( ! function_exists( 'gaff_lite_print_post_author' ) ) : /** * Print post author info on single blog post page. * * @since 1.0.0 */ function gaff_lite_print_post_author() { if ( 'post' !== get_post_type() ) { return; } global $post; $author_ID = $post->post_author; $avatar = get_avatar( $author_ID, 96 ); $name = get_the_author_meta( 'display_name', $author_ID ); $desc = get_the_author_meta( 'description', $author_ID ); $posts_url = get_author_posts_url( $author_ID ); // HTML $html = '
'; $html .= '
' . $avatar . '
'; $html .= '

'; $html .= '' . esc_html( $name ) . ''; $html .= '

'; $html .= '
' . $desc . '
'; $html .= '
'; echo $html; } endif; if ( ! function_exists( 'gaff_lite_print_the_content' ) ) : /** * Print custom the_content(). Combines excerpt, read more link * and the content into one function. * * - Prints automatically trimmed excerpt from the content as default. * - If read more tag is set, prints the content and read more tag. * - If custom excerpt is set, prints custom excerpt. * * Also includes wp_link_pages(). * @see https://codex.wordpress.org/Function_Reference/wp_link_pages * * @since 1.0.0 */ function gaff_lite_print_the_content() { global $post; // Posts loop pages if ( is_home() || is_archive() || is_search() || is_page_template( 'page-templates/blog.php') || is_page_template( 'page-templates/home.php' ) ) { if ( strpos( $post->post_content, '' ) ) { the_content( '' ); echo '
Read More
'; } elseif ( is_page_template( 'page-templates/home.php' ) ) { the_excerpt(); } else { the_excerpt(); } } // Singular pages else { the_content(); wp_link_pages( array( 'before' => '
' . esc_html__( 'Pages', 'gaff-lite' ) . ':', 'after' => '
', 'pagelink' => '%' ) ); } } endif; if ( ! function_exists( 'gaff_lite_print_post_nav' ) ) : /** * Display navigation to next/previous post when applicable. * * @since 1.0.0 */ function gaff_lite_print_post_nav() { // Don't print empty markup if there's nowhere to navigate. $prev = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $prev ) { return; } ?> max_num_pages; } // Do nothing if there's only one page. if ( $max_pages < 2 ) { return; } // Print HTML ?> comment_type || 'trackback' == $comment->comment_type ) : ?>
  • >
    ', '' ); ?>
  • >
    comment_approved ) : ?>

    'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
    ', 'after' => '
    ', ) ) ); ?>
  • '
    ', 'email' => '
    ', 'url' => '
    ', ); // custom textarea $comment_field = '
    '; $comment_form_args = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'comment_field' => $comment_field, 'comment_notes_before' => '', 'comment_notes_after' => '', 'label_submit' => esc_html__( 'Post Comment', 'gaff-lite' ), 'title_reply' => esc_html__( 'Leave a Comment', 'gaff-lite' ), 'title_reply_to' => esc_html__( 'Leave a Reply to %s', 'gaff-lite'), ); /** * Hack and add CSS classes as WP has not supported * functionality to do so cleanly (yet?). * * @since 1.0.0 */ // Cache comment form ob_start(); comment_form( $comment_form_args ); $comment_form_html = ob_get_clean(); // Replace outer most container class $comment_form_html = str_replace( 'class="comment-respond"', 'class="c-comment-respond"', $comment_form_html ); // Replace reply title class $comment_form_html = str_replace( 'class="comment-reply-title"', 'class="comment-reply-title c-comment-respond__reply-title"', $comment_form_html ); // Add cancel reply class $comment_form_html = str_replace( 'id="cancel-comment-reply-link"', 'id="cancel-comment-reply-link" class="c-comment-respond__cancel-reply"', $comment_form_html ); // Replace comment form class $comment_form_html = str_replace( 'class="comment-form"', 'class="c-comment-form"', $comment_form_html ); $comment_form_html = str_replace( 'class="form-submit"', 'class="c-comment-form__submit form-submit"', $comment_form_html ); echo $comment_form_html; } endif;