【问题标题】:how to get a valid url for pinterest share on wordpress site如何在 wordpress 网站上获取 pinterest 共享的有效 url
【发布时间】:2014-02-09 18:45:49
【问题描述】:

我的 pinterest 分享网址返回无效。收到此错误:

参数'method'(值链接)不是unknown、uploaded、scraped、bookmarklet、email、iphone、button、ipad、android、android_tablet、api_sdk、extension、api_other、bad之一。

我不明白为什么会这样,因为生成的 URL 是正确的。我的代码是:

<?php
    $postpermalink = urlencode( get_permalink() );
    $featureImage = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large-thumb');
?>

<a href="//pinterest.com/pin/create/link/?url=<?php echo $postpermalink ?>&amp;media=
    <?php echo urlencode($featureImage[0]);?>&amp;description=<?php the_title() ?>" target="_blank">
    <img src="<?php bloginfo('template_url') ?>/core/images/pinterest-icon.png" alt="Pin it" 
width="26px" height="26px" title="Pin it"/>
</a>

在页脚中:

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>

有人知道这个问题的解决方案吗?

【问题讨论】:

    标签: php url share pinterest


    【解决方案1】:

    我的情况有些不同,但我最终在此页面上寻找相同问题的答案。我猜问题是您的锚点中缺少 data-pin-do 和 data-pin-config 属性。

    我完全按照Pinterest's guide 进行操作, 然后小心翼翼地生成自己的 URL 和视觉效果。

    我在本地测试时也遇到了错误,但在远程服务器上没有。显然,网站需要能够访问服务器才能获取信息,但 Pinterest 令人讨厌; Facebook 和 Twitter 将尽其所能而不是仅仅抛出错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-09
      相关资源
      最近更新 更多