post_type, 'comments' ) ) { return; } if ( is_singular() && ! in_array( $post->post_type, array( 'post', 'page' ) ) ) { comments_template( '', true ); } elseif ( is_singular( 'post' ) && ( bizznis_get_option( 'trackbacks_posts' ) || bizznis_get_option( 'comments_posts' ) ) ) { comments_template( '', true ); } elseif ( is_singular( 'page' ) && ( bizznis_get_option( 'trackbacks_pages' ) || bizznis_get_option( 'comments_pages' ) ) ) { comments_template( '', true ); } } /** * Echo Bizznis default comment structure. * * @since 1.0.0 */ add_action( 'bizznis_comments', 'bizznis_do_comments', 5 ); function bizznis_do_comments() { global $post, $wp_query; # Stop here if comments are off for this post type if ( ( is_page() && ! bizznis_get_option( 'comments_pages' ) ) || ( is_single() && ! bizznis_get_option( 'comments_posts' ) ) ) { return; } if ( have_comments() && ! empty( $wp_query->comments_by_type['comment'] ) ) { printf( '
', bizznis_attr( 'entry-comments' ) ); echo apply_filters( 'bizznis_title_comments', __( '

Comments

', 'bizznis' ) ); echo '
    '; do_action( 'bizznis_list_comments' ); echo '
'; # Comment Navigation $prev_link = get_previous_comments_link( apply_filters( 'bizznis_prev_comments_link_text', '' ) ); $next_link = get_next_comments_link( apply_filters( 'bizznis_next_comments_link_text', '' ) ); if ( $prev_link || $next_link ) { printf( ''; } echo '
'; } # No comments so far elseif ( 'open' == $post->comment_status && $no_comments_text = apply_filters( 'bizznis_no_comments_text', '' ) ) { echo sprintf( '
', bizznis_attr( 'entry-comments' ) ) . $no_comments_text . '
'; } elseif ( $comments_closed_text = apply_filters( 'bizznis_comments_closed_text', '' ) ) { echo sprintf( '
', bizznis_attr( 'entry-comments' ) ) . $comments_closed_text . '
'; } } /** * Echo Bizznis default trackback structure. * * @since 1.0.0 */ add_action( 'bizznis_comments', 'bizznis_do_pings', 10 ); function bizznis_do_pings() { global $wp_query; # Stop here if trackbacks are off for this post type if ( ( is_page() && ! bizznis_get_option( 'trackbacks_pages' ) ) || ( is_single() && ! bizznis_get_option( 'trackbacks_posts' ) ) ) { return; } # If have pings if ( have_comments() && !empty( $wp_query->comments_by_type['pings'] ) ) { printf( '
', bizznis_attr( 'entry-pings' ) ); echo apply_filters( 'bizznis_title_pings', __( '

Trackbacks

', 'bizznis' ) ); echo '
    '; do_action( 'bizznis_list_pings' ); echo '
'; echo '
'; } else { echo apply_filters( 'bizznis_no_pings_text', '' ); } } /** * Output the list of trackbacks. * * @since 1.0.0 */ add_action( 'bizznis_list_pings', 'bizznis_default_list_pings' ); function bizznis_default_list_pings() { $args = apply_filters( 'bizznis_ping_list_args', array( 'type' => 'pings', ) ); wp_list_comments( $args ); } /** * Output the list of comments. * * @since 1.0.0 */ add_action( 'bizznis_list_comments', 'bizznis_default_list_comments' ); function bizznis_default_list_comments() { $defaults = array( 'type' => 'comment', 'avatar_size' => 42, 'format' => 'html5', # Not necessary, but a good example 'callback' => 'bizznis_comment_callback', ); $args = apply_filters( 'bizznis_comment_list_args', $defaults ); wp_list_comments( $args ); } /** * Does 'bizznis_before_comment' and 'bizznis_after_comment' actions. * * @since 1.0.0 */ function bizznis_comment_callback( $comment, array $args, $depth ) { $GLOBALS['comment'] = $comment; ?>
  • id="comment-">
    >

    > %s', esc_url( $url ), $author ); printf( '%s %s', $author, apply_filters( 'comment_author_says_text', __( 'says', 'bizznis' ) ) ); ?>

    ', $comment ); printf( $pattern, esc_attr( get_comment_time( 'c' ) ), esc_url( get_comment_link( $comment->comment_ID ) ), esc_html( get_comment_date() ), __( 'at', 'bizznis' ), esc_html( get_comment_time() ) ); edit_comment_link( __( '(Edit)', 'bizznis' ), ' ' ); ?>

    comment_approved == '0' ) { ?>

    $depth, 'before' => '
    ', 'after' => '
    ', ) ) ); ?>
    tag because of comment threading } /** * Optionally show the comment form. * * @since 1.0.0 */ add_action( 'bizznis_comments', 'bizznis_do_comment_form', 15 ); function bizznis_do_comment_form() { # Stop here if comments are closed for this post type if ( ( is_page() && ! bizznis_get_option( 'comments_pages' ) ) || ( is_single() && ! bizznis_get_option( 'comments_posts' ) ) ) { return; } comment_form( array( 'format' => 'html5' ) ); } /** * Filter the default comment form arguments, used by 'comment_form()'. * * @since 1.0.0 */ // add_filter( 'comment_form_defaults', 'bizznis_comment_form_args' ); function bizznis_comment_form_args( array $defaults ) { global $user_identity; $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? ' aria-required="true"' : '' ); $author = '
    ' . '' . '' . '
    '; $email = '
    ' . '' . '' . '
    '; $url = '
    ' . '' . '' . '
    '; $comment_field = '
    ' . '' . '
    '; $args = array( 'comment_field' => $comment_field, 'title_reply' => __( 'Leave a Reply', 'bizznis' ), 'comment_notes_before' => '', 'comment_notes_after' => '', 'fields' => array( 'author' => $author, 'email' => $email, 'url' => $url, ), ); # Merge $args with $defaults $args = wp_parse_args( $args, $defaults ); # Return filterable array of $args, along with other optional variables return apply_filters( 'bizznis_comment_form_args', $args, $user_identity, get_the_ID(), $commenter, $req, $aria_req ); } /** * Filter the comments link. If post has comments, link to #comments div. If no, link to #respond div. * * @since 1.0.0 */ add_filter( 'get_comments_link', 'bizznis_comments_link_filter', 10, 2 ); function bizznis_comments_link_filter( $link, $post_id ) { if ( 0 == get_comments_number() ) { return get_permalink( $post_id ) . '#respond'; } return $link; }