【问题标题】:Some thing wrong with my sharing script [closed]我的共享脚本出了点问题[关闭]
【发布时间】:2015-03-31 18:18:39
【问题描述】:

请帮帮我,这是我要嵌入 facebook 共享脚本的代码。

<a href=""><i class="fa fa-facebook fa-2x"></i></a>

这就是我嵌入它的方式

 <script>function fbs_click() {u=location.href;t=document.title;window.open(‘http://www.facebook.com/sharer.php?u=’+encodeURIComponent(u)+’&t=’+encodeURIComponent(t),’sharer’,’toolbar=0,status=0,width=626,height=436′);return false;}</script>
                              <a href="<?php echo'http://www.facebook.com/share.php?u=';?><?php the_permalink(); ?>"
                                 onclick=”return fbs_click()” target=”_blank”><i class="fa fa-facebook fa-2x"></i></a>

【问题讨论】:

    标签: javascript php wordpress facebook sharing


    【解决方案1】:

    <script>
    function facebook()
    {
    window.open("http://facebook.com/sharer.php?app_id=1433580610197489&sdk=joey&u=<?php the_permalink(); ?>","_blank","toolbar=no, scrollbars=no, resizable=yes, top=500, left=500, width=650, height=540");
    }
    
    function google()
    {
    window.open("https://plus.google.com/share?url=<?php the_permalink(); ?>","_blank","toolbar=no, scrollbars=no, resizable=yes, top=500, left=500, width=650, height=540");
    }
    function twitter()
    {
    window.open("http://twitter.com/home?status=<?php the_permalink(); ?>","_blank","toolbar=no, scrollbars=no, resizable=yes, top=500, left=500, width=650, height=540");
    }
    function linkedin()
    {
    window.open("http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title='.$title.'","_blank","toolbar=no, scrollbars=no, resizable=yes, top=500, left=500, width=650, height=540");
    }
    function pinterest()
    {
    window.open("http://pinterest.com/pin/create/link/?url=<?php the_permalink(); ?>","_blank","toolbar=no, scrollbars=no, resizable=yes, top=500, left=500, width=650, height=540");
    }
    </script> 
    <ul>
    	<li class="social-facebook"><a title="Facebook" onclick="facebook()" ><i class="fa fa-facebook"></i></a></li>
    	<li class="social-gplus"><a title="Google+" onclick="google()" ><i class="fa fa-google-plus"></i></a></li>
    	<li class="social-twitter"><a title="Twitter" onclick="twitter()" ><i class="fa fa-twitter"></i></a></li>
    	<li class="social-pinterest"><a title="Pinterest" onclick="pinterest()" ><i class="fa fa-pinterest"></i></a></li>
    	<li class="social-linkedin"><a title="LinkedIn" onclick="linkedin()" ><i class="fa fa-linkedin"></i></a></li>
    </ul>

    【讨论】:

    • 只是一个问题与代码.. 它继续分享我第一次分享的同一个帖子,即使我分享了一些永久链接不同的不同帖子.. 任何想法
    • 其实如果首页有十个帖子,那么它总是保持分享页面上的最后一个帖子-
    • 有些小问题现在它在 u= 之后没有生成链接
    • 添加回显:
    • 可能是问题站点托管在子域上,因为它不起作用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-15
    • 1970-01-01
    • 2014-11-10
    相关资源
    最近更新 更多