简体   繁体   English

带有帖子 ID 的 Facebook 评论短代码

[英]Facebook Comments Shortcode with Post ID

I am using a wordpress template for Music Promotion and trying to connect facebook comments plugin via " https://developers.facebook.com/docs/plugins/comments/ " ... I understood all the steps and successfully connected by the shortcode with browser.. Here is the single album page where the comment plugin shows after the listed songs... " http://shanmp3.net/?download=sai-aung-htee-kham&lang=en "我正在使用 wordpress 模板进行音乐推广,并尝试通过“ https://developers.facebook.com/docs/plugins/comments/ ”连接 facebook 评论插件......我了解所有步骤并通过短代码成功连接浏览器..这里是单曲专辑页面,评论插件显示在列出的歌曲之后......“ http://shanmp3.net/?download=sai-aung-htee-kham&lang=en

 HERE IS THE SHORTCODE I AM USING FOR FACEBOOK COMMENTS IN MY SINGLE-CONTENT-PAGE.PHP <div class="fb-comments" data-href="https://www.shanmp3.net" data-numposts="5"></div>

ACTUAL PROBLEM When I comment on any post it not working as unique and showing the same comment on all the post as I am using "PHP" Single Content Page so I am unable to write a proper code as实际问题当我对任何帖子发表评论时,它不会像我使用“PHP”单一内容页面那样在所有帖子上显示相同的评论,因此我无法编写正确的代码

 <?php echo urlencode(get_permalink($post->id)); ?>

which work unique for each Post.对于每个帖子来说都是独一无二的。

I appreciate if you provide me the correct PHP Code as per Post ID which work unique for each post.如果您根据帖子 ID 为我提供正确的 PHP 代码,这对每个帖子都是唯一的,我将不胜感激。

Cheers...干杯...

Alright I have just sorted out myself and its very simple as you just need to replace :好吧,我刚刚整理了自己,它非常简单,因为您只需要替换:

 <div class="fb-comments" data-href="mydomain.com" data-numposts="5"></div>

mydomain.com with PHP the_permalink as the following: mydomain.com 和 PHP the_permalink 如下:

 <div class="fb-comments" data-href="<?php the_permalink() ?>" data-numposts="5"></div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM