简体   繁体   English

将喜欢按钮/推特按钮与各个帖子相关联

[英]Associate Like Buttons/Tweet Buttons with Individual Posts

I Have Created a PHP Blog coded by myself. 我已经创建了一个由我自己编写的PHP博客。 On the Homepage, all the recent posts are displayed. 在主页上,显示所有最近的帖子。

I added the Code for Facebook Like and Tweet under the title of each post, but the Buttons work for the homepage, instead of each individual post. 我在每个帖子的标题下添加了Facebook Like和Tweet的代码,但是Buttons适用于主页,而不是每个帖子。 All the button contain same values. 所有按钮都包含相同的值。

The buttons work fine for each individual post when displayed as a single page with their own URL. 当按钮显示为具有自己的URL的单个页面时,这些按钮对于每个帖子均适用。

How can i Make the Like buttons work for individual posts from homepage. 我如何使“喜欢”按钮可用于主页上的各个帖子。

Use the URL of the individual blog entry in the Like button code. 在“赞”按钮代码中使用单个博客条目的URL。 For example if using HTML5 version of Like button then something like: 例如,如果使用HTML5版本的“喜欢”按钮,则类似:

<div class="fb-like" data-href="http://www.example.com/blog/1" data-send="false" data-width="450" data-show-faces="false"></div>
<div class="fb-like" data-href="http://www.example.com/blog/2" data-send="false" data-width="450" data-show-faces="false"></div>

Or if using XFMBL version then: 或者,如果使用XFMBL版本,则:

<fb:like href="http://www.example.com/blog/1" send="false" width="450" show_faces="false"></fb:like>
<fb:like href="http://www.example.com/blog/2" send="false" width="450" show_faces="false"></fb:like>

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

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