%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( 'Posted on %s', 'post date', 'ramza' ), '' . $time_string . '' ); // Author $author = sprintf( esc_html_x( 'by %s', 'post author', 'ramza' ), '' . esc_html( get_the_author() ) . '' ); if ( 'post' === get_post_type() ) { echo '
'; // Date if ( $theme_options['content_display_c-posted-on'] ) { echo '' . $posted_on . ''; } // Author if ( $theme_options['content_display_c-author'] ) { echo '' . $author . ''; // WPCS: XSS OK. } // Comments if ( $theme_options['content_display_c-post__comments-link'] ) { if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( 'Leave a comment', 'ramza' ), esc_html__( '1 Comment', 'ramza' ), esc_html__( '% Comments', 'ramza' ) ); echo ''; } } echo '
'; } } endif; if ( ! function_exists( 'ramza_print_post_footer' ) ) : /** * Prints HTML with meta information for the categories, tags. * * @since 1.0.0 */ function ramza_print_post_footer() { // Do nothing for pages. if ( 'post' !== get_post_type() ) { return; } $categories_list = get_the_category_list( ', ' ); $tags_list = get_the_tag_list( '', ', ' ); echo '
'; if ( $categories_list && ramza_categorized_blog() ) { printf( '
' . esc_html__( 'Posted in %1$s', 'ramza' ) . '
', $categories_list ); // WPCS: XSS OK. } if ( $tags_list ) { printf( '
' . esc_html__( 'Tagged %1$s', 'ramza' ) . '
', $tags_list ); // WPCS: XSS OK. } echo '
'; } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function ramza_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'ramza_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( 'ramza_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so ramza_categorized_blog should return true. return true; } else { // This blog has only 1 category so ramza_categorized_blog should return false. return false; } } /** * Flush out the transients used in ramza_categorized_blog. */ function ramza_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'ramza_categories' ); } add_action( 'edit_category', 'ramza_category_transient_flusher' ); add_action( 'save_post', 'ramza_category_transient_flusher' ); if ( ! function_exists( 'ramza_print_post_thumbnail' ) ) : /** * Prints custom the_post_thumbnail(). * * @since 1.0.0 * * @param string $size Post thumbnail size. */ function ramza_print_post_thumbnail( $size = '' ) { if ( ! has_post_thumbnail() ) { return; } echo ''; } endif; if ( ! function_exists( 'ramza_print_post_author' ) ) : /** * Print post author info on single blog post page. * * @since 1.0.0 */ function ramza_print_post_author() { if ( 'post' !== get_post_type() ) { return; } global $post; $author_ID = $post->post_author; $avatar = get_avatar( $author_ID, 80 ); $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 .= '
'; $html .= ''; $html .= ''; $html .= ''; $html .= '
'; $html .= '
'; echo $html; } endif; if ( ! function_exists( 'ramza_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 ramza_print_the_content() { global $post; // Posts loop pages if ( is_home() || is_archive() || is_search() ) { if ( strpos( $post->post_content, '' ) ) { the_content( '' ); echo '
Read More
'; } else { the_excerpt(); } } // Singular pages else { the_content(); wp_link_pages( array( 'before' => '
' . esc_html__( 'Pages', 'ramza' ) . ':', 'after' => '
', 'pagelink' => '%' ) ); } } endif; if ( ! function_exists( 'ramza_print_posts_nav' ) ) : /** * Display posts navigation when available. * * @since 1.0.0 * * @todo Check this function when WordPress 4.3 is released. * * @param int $max_pages Max number of pages of WP Query. */ function ramza_print_posts_nav( $max_pages = '' ) { if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' ) ) { // Do not print this nav if Jetpack Infinite Scroll is active return; } // If no custom WP query is set, use global WP query if ( '' === $max_pages ) { $max_pages = $GLOBALS['wp_query']->max_num_pages; } // Do nothing if there's only one page. if ( $max_pages < 2 ) { return; } // Print HTML ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $prev ) { return; } ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $prev ) { return; } ?> 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', 'ramza' ), 'title_reply' => esc_html__( 'Leave a Comment', 'ramza' ), 'title_reply_to' => esc_html__( 'Leave a Reply to %s', 'ramza'), ); /** * 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(); $o_box_mod = is_page_template( 'page-templates/full-width.php' ) ? 'full' : 'content'; // Replace outer most container class $comment_form_html = str_replace( 'class="comment-respond"', 'class="c-comment-respond o-box o-box--' . $o_box_mod . '"', $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 ); echo $comment_form_html; } endif;