Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 创建自定义Pinterest共享按钮:pinit.js有问题吗?_Php_Wordpress_Pinterest_Custom Wordpress Pages - Fatal编程技术网

Php 创建自定义Pinterest共享按钮:pinit.js有问题吗?

Php 创建自定义Pinterest共享按钮:pinit.js有问题吗?,php,wordpress,pinterest,custom-wordpress-pages,Php,Wordpress,Pinterest,Custom Wordpress Pages,我一直在使用4.7.3 Wordpress安装,并创建了一个自定义pinterest共享按钮,放置在我的页脚中,其中已经存在其他社交共享图标,例如: <div class="mysharingclass"> <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo the_permalink() ?>" target="_blank"><i class="icon-facebook"

我一直在使用4.7.3 Wordpress安装,并创建了一个自定义pinterest共享按钮,放置在我的页脚中,其中已经存在其他社交共享图标,例如:

<div class="mysharingclass">
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo the_permalink() ?>" target="_blank"><i class="icon-facebook"></i></a>
<a  href="https://twitter.com/intent/tweet?text=<?php echo urlencode( the_permalink() ) ?>" target="_blank"><i class="icon-twitter"></i></a>
</div>
正如您可能已经注意到的,不要在URL中使用:

http://pinterest.com/pin/create/button/?url
我宁愿称之为:

//pinterest.com/pin/create/%20button?url 
显然,当您希望包含自己的自定义按钮并绕过调用pinit.js时,这似乎是正确的URL。结果是共享URL正常工作,但它显示了“缺少Href”错误,如下面的屏幕截图所示:

我非常困惑,因为我没有看到我的共享代码有任何错误,这是我通过检查元素可以看到的:

<a href="//pinterest.com/pin/create/%20button?url==http%3A%2F%2Flocalhost%2Fmywebsite%2Findex.php%2F2017%2F04%2F16%2Fhello-world%2F&amp;media=&amp;description=Hello world!" data-pin-do="buttonPin" data-pin-custom="true" target="_blank"><i class="icon-pinterest"></i></a>

然而,URL返回一个空白屏幕,这是为什么


谢谢你的帮助

根据您的编辑,脚本可能存在于http或https上。我不知道你是如何建立你的网址,但它看起来像它的一些硬类型和其他部分正在使用网址编码。您可能希望将完整的字符串传递到编码器中。如果它返回一个空白屏幕,那么首先检查浏览器开发控制台。页面上可能有一些错误。如果没有任何内容,请检查您的php日志。我不知道你的模板是如何修改的,但从那里开始。
//pinterest.com/pin/create/%20button?url 
<a href="//pinterest.com/pin/create/%20button?url==http%3A%2F%2Flocalhost%2Fmywebsite%2Findex.php%2F2017%2F04%2F16%2Fhello-world%2F&amp;media=&amp;description=Hello world!" data-pin-do="buttonPin" data-pin-custom="true" target="_blank"><i class="icon-pinterest"></i></a>
<script
        type="text/javascript"
        async defer
        src="//assets.pinterest.com/js/pinit.js"
    ></script>
<script type=”text/javascript” src=”//assets.pinterest.com/js/pinit.js”></script>
<script type=”text/javascript” src=”http://assets.pinterest.com/js/pinit.js”></script>
https://www.pinterest.com/pin/create/%20button/?url=%3Dhttp%3A%2F%2Flocalhost%2Fmywebsite%2Findex.php%2F2017%2F04%2F16%2Fhello-world%2F&media=&description=Hello%20world!