【问题标题】:Code to show the thumbnail in wordpress custom code facebook sharer在wordpress自定义代码facebook共享器中显示缩略图的代码
【发布时间】:2013-02-07 10:45:24
【问题描述】:
<a title="Share this post/page"
href="http://www.facebook.com/sharer.php?
s=100

&p[url]=<?php the_permalink() ?>
&p[images][0]=
&p[title]=<?php the_title(); ?>
&p[summary]=<?php the_excerpt() ?>"
target="_blank">
<img src="http://www.ironwillfootball.ca/wp-content/themes/IronWillThemes/images/share_01.png"
alt="Share on Facebook" />
</a>

这是我的 Facebook 分享代码,这一行 -> &p[images][0]= 为空.. 我如何在此处添加图像?如果wordpress中缩略图的链接是这样的-> img src= ID, $key, true); ?>

真正的问题是我在 wordpress 中分享帖子时看不到缩略图..

【问题讨论】:

  • 我想要一个具体的答案。谢谢:)

标签: wordpress thumbnails facebook-sharer


【解决方案1】:

首先,sharer.php 已被弃用并且已经有一段时间了。请记住,它可能随时停止工作。您最好使用 Feed 对话框进行开发。

假设您的代码在循环内运行,您可以使用 WordPress get_posts() 函数返回附件。 WordPress Codex has an example 正是你要找的,这里不再赘述。

如果您在循环之外执行此操作,则需要使用get_children(),这也是described in the Codex

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-04
    • 2013-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-26
    • 2014-05-05
    相关资源
    最近更新 更多