WPDiscourse\Templates\HTMLTemplates::replies_html PHP Method

replies_html() public static method

Can be customized from within a theme using the filter provided. Available tags: {comments}, {discourse_url}, {discourse_url_name}, {topic_url}, {more_replies}, {participants}
public static replies_html ( ) : mixed | void
return mixed | void
    public static function replies_html()
    {
        ob_start();
        ?>
		<div id="comments" class="comments-area">
			<h2 class="comments-title"><?php 
        esc_html_e('Notable Replies', 'wp-discourse');
        ?>
</h2>
			<ol class="comment-list">{comments}</ol>
			<div class="respond comment-respond">
				<h3 id="reply-title" class="comment-reply-title">
					<a href="{topic_url}"><?php 
        esc_html_e('Continue the discussion', 'wp-discourse');
        ?>
					</a><?php 
        esc_html_e(' at ', 'wp-discourse');
        ?>
{discourse_url_name}
				</h3>
				<p class="more-replies">{more_replies}</p>
				<p class="comment-reply-title">{participants}</p>
			</div><!-- #respond -->
		</div>
		<?php 
        $output = ob_get_clean();
        return apply_filters('discourse_replies_html', $output);
    }

Usage Example

示例#1
0
            $comment_html = str_replace('{username}', esc_html($post->username), $comment_html);
            $comment_html = str_replace('{fullname}', esc_html($post->name), $comment_html);
            $comment_body = Discourse::convert_relative_img_src_to_absolute($discourse_url, $post->cooked);
            $comment_html = str_replace('{comment_body}', wp_kses_post($comment_body), $comment_html);
            $comment_html = str_replace('{comment_created_at}', mysql2date($datetime_format, get_date_from_gmt($post->created_at)), $comment_html);
            $comments_html .= $comment_html;
        }
        foreach ($discourse_info->participants as &$participant) {
            $participant_html = wp_kses_post(Templates\HTMLTemplates::participant_html());
            $participant_html = str_replace('{discourse_url}', $discourse_url, $participant_html);
            $participant_html = str_replace('{discourse_url_name}', $discourse_url_name, $participant_html);
            $participant_html = str_replace('{topic_url}', $permalink, $participant_html);
            $avatar_url = Discourse::avatar($participant->avatar_template, 64);
            $participant_html = str_replace('{avatar_url}', esc_url($avatar_url), $participant_html);
            $user_url = Discourse::homepage($options['url'], $participant);
            $participant_html = str_replace('{user_url}', esc_url($user_url), $participant_html);
            $participant_html = str_replace('{username}', esc_html($participant->username), $participant_html);
            $participants_html .= $participant_html;
        }
        $discourse_html = wp_kses_post(Templates\HTMLTemplates::replies_html());
        $discourse_html = str_replace('{more_replies}', $more_replies, $discourse_html);
    } else {
        $discourse_html = wp_kses_post(Templates\HTMLTemplates::no_replies_html());
    }
    $discourse_html = str_replace('{discourse_url}', $discourse_url, $discourse_html);
    $discourse_html = str_replace('{discourse_url_name}', $discourse_url_name, $discourse_html);
    $discourse_html = str_replace('{topic_url}', $permalink, $discourse_html);
    $discourse_html = str_replace('{comments}', $comments_html, $discourse_html);
    $discourse_html = str_replace('{participants}', $participants_html, $discourse_html);
    echo $discourse_html;
}