mirror of
https://github.com/discourse/wp-discourse.git
synced 2025-10-03 08:59:21 +08:00
Add discourse_comments_number argument
This commit is contained in:
parent
7e40083cf4
commit
4d0524ad3f
1 changed files with 14 additions and 7 deletions
|
@ -21,24 +21,28 @@ class HTMLTemplates {
|
|||
*
|
||||
* @param string $option The option key.
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
protected static function get_text_options( $option ) {
|
||||
$text_options = get_option( 'discourse_configurable_text' );
|
||||
|
||||
echo esc_html( $text_options[ $option ] );
|
||||
$text = ! empty( $text_options[ $option ] ) ? $text_options[ $option ] : '';
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target attribute.
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
protected static function target() {
|
||||
$comment_options = get_option( 'discourse_comment' );
|
||||
if ( ! empty( $comment_options['discourse-new-tab'] ) ) {
|
||||
echo 'target="_blank"';
|
||||
return 'target="_blank"';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,13 +95,16 @@ class HTMLTemplates {
|
|||
* @static
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function no_replies_html() {
|
||||
public static function no_replies_html( $discourse_comments_number = null ) {
|
||||
ob_start();
|
||||
?>
|
||||
<div id="comments" class="comments-area">
|
||||
<div class="respond comment-respond">
|
||||
<h3 id="reply-title" class="comment-reply-title">
|
||||
<?php esc_html( self::get_text_options( 'start-discussion-text' ) . ' ' ); ?>
|
||||
<?php
|
||||
$text = $discourse_comments_number > 0 ? self::get_text_options( 'join-discussion-text' ) : self::get_text_options( 'start-discussion-text' );
|
||||
?>
|
||||
<?php esc_html( $text ) . ' '; ?>
|
||||
<a <?php self::target(); ?> href="{topic_url}">
|
||||
{discourse_url_name}
|
||||
</a></h3>
|
||||
|
@ -158,7 +165,7 @@ class HTMLTemplates {
|
|||
width="64">
|
||||
<b class="fn"><a href="{topic_url}" rel="external"
|
||||
class="url">{username}</a></b>
|
||||
<span class="says screen-reader-text"><?php esc_html_e( 'says:', 'wp-discourse' ); ?></span><!-- screen reader text -->
|
||||
<span class="says screen-reader-text"><?php esc_html( 'says:', 'wp-discourse' ); ?></span><!-- screen reader text -->
|
||||
</div>
|
||||
<!-- .comment-author -->
|
||||
<div class="comment-metadata">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue