ajax评论设置问题

是的,它的显示方式取决于您的主题。插件本身只有很少的样式。

“加入讨论”链接不会出现在未链接的主题上。不过,您可以通过在主题的 functions.php 文件中使用 comments_template 过滤器自行添加类似内容。我没有测试过这段代码,但类似这样的代码应该可以工作:

use WPDiscourse\Utilities\Utilities as DiscourseUtilities;

function non_discourse_comments_template( $comment_template ) {
   global $post;
   $post_id = $post->ID;
   $discourse_post_id = get_post_meta( $post_id, 'discourse_post_id', true );

   if ($discourse_post_id) {
     return;
   } else {
     $options = DiscourseUtilities::get_options();
     $discourse_permalink = $options['url'];
     $link_text = "Join the Discussion";
     return '<div class="wpdc-join-discussion"><a class="wpdc-join-discussion-link" href="' . esc_url_raw( $discourse_permalink ) . '" target="_blank" rel="noreferrer noopener">' . esc_html( $link_text ) . '</a></div>';
   }
}
add_filter( "comments_template", "non_discourse_comments_template" );
2 个赞