我正在使用插件“wpdavart-facebook-comment”在每篇文章的末尾发表评论。他们显示得很好,但现在我想把这些评论移到分页和广告的下方或页面的末尾,但评论应该是相关帖子的。随附屏幕截图:
为此,我在单曲中添加了插件短代码。php
while ( have_posts() ) : the_post();
$bimber_post_settings = bimber_get_post_settings();
bimber_set_template_part_data( $bimber_post_settings );
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-single-classic-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( \'template-parts/content-single-classic\', get_post_format() );
comments_template();
//facebook comments
echo do_shortcode(\'[wpdevart_facebook_comment facebook_app_id="12345678910111213" curent_url="http://developers.facebook.com/docs/plugins/comments/" order_type="social" title_text="Facebook Comment" title_text_color="#000000" title_text_font_size="16" title_text_font_famely="Arial" title_text_position="left" width="100%" bg_color="#000000" animation_effect="none" count_of_comments="10" ]\');
bimber_reset_template_part_data();
endwhile;
?>
但它会显示所有帖子和页面的所有评论。
最合适的回答,由SO网友:Castiblanco 整理而成
来自插件的用户手册。
Curent_url - 键入需要显示Facebook评论的页面URL
因此,您必须更改当前URL(http://developers.facebook.com/docs/plugins/comments/) 到您当前的真实URL。
global $wp;
$current_url = home_url( add_query_arg( array(), $wp->request ) );
echo do_shortcode(\'[wpdevart_facebook_comment facebook_app_id="12345678910111213" curent_url="\'.$current_url.\'
" order_type="social" title_text="Facebook Comment" title_text_color="#000000" title_text_font_size="16" title_text_font_famely="Arial" title_text_position="left" width="100%" bg_color="#000000" animation_effect="none" count_of_comments="10" ]\');