让 Facebook 像指向博客文章网址一样?
我正在向我的 WordPress 页面添加类似 facebook 的按钮。在 single.php 上,对于每篇博客文章 - 效果都很好。但我还想在索引页面上的帖子中添加类似 facebook 的按钮。我可以这样做,但检索到的 url 是主索引页面,这是有道理的。有没有一种方法可以在我的博客主页上有多个“喜欢”按钮,并且仍然使每个按钮都指向该帖子?
I´m adding facebook like buttons to my wordpress-page. On single.php, for each blog post - which works fine. But I would also like to add facebook like button to the posts on the index page. I could do that, but the url retrieved is the main index page, which makes sense. Is there a way I can have multiple like buttons on my blog main page, and still make each one of them to point to the post?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以将每个点赞按钮的
href
参数设置为帖子永久链接。这是 HTML 版本中的data-href
属性:Yes, you set the
href
parameter for each individual like button to the post permalink. It's thedata-href
attribute in the HTML version:那么,在索引页和“The Loop”内部,您可以使用
the_permalink()
用作“赞”按钮href
。Well, in the index page and inside "The Loop", you could use the
the_permalink()
function as your Like buttonhref
.