广告投放

WordPress文章底部添加Twitter和Facebook按钮

目录

    Wordpress文章底部添加Twitter和Facebook按钮
    wordpress

    如何在WordPress文章底部自动添加上Facebook和tewitter的按钮?把下面的代码粘贴到您的 functions.php 模板文件中,保存,大功告成了。虽然Twitter已被GFW,记录一下添加方法也不错。

    function share_this($content){
    if(!is_feed() && !is_home()) {
    $content .= '<div class="share-this">
    <a href="http://twitter.com/share"
    class="twitter-share-button"
    data-count="horizontal">Tweet</a>
    <script type="text/javascript"
    src="http://platform.twitter.com/widgets.js"></script>
    <div class="facebook-share-button">
    <iframe
    src="http://www.facebook.com/plugins/like.php?href='.
    urlencode(get_permalink($post->ID))
    .'&amp;layout=button_count&amp;show_faces=false&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21"
    scrolling="no" frameborder="0" style="border:none;
    overflow:hidden; width:200px; height:21px;"
    allowTransparency="true"></iframe>
    </div>
    </div>';
    }
    return$content;
    }
    add_action('the_content', 'share_this');
    声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

    给TA打赏
    共{{data.count}}人
    人已打赏
    广告位招租919838898
    0 条回复 A文章作者 M管理员
      暂无讨论,说说你的看法吧
    个人中心
    购物车
    优惠劵
    今日签到
    有新私信 私信列表
    搜索