首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何添加更多社交分享按钮

如何添加更多社交分享按钮
EN

Stack Overflow用户
提问于 2019-12-07 11:14:41
回答 2查看 250关注 0票数 1

我正在尝试添加更多的分享按钮到我的wordpress博客。这是它的起源:

代码语言:javascript
复制
<div class="sharing">
    <div class="sharing-facebook">
        <a data-shareto="<?php _e('Facebook', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo wp_get_shortlink() ?>"><i class="fa fa-facebook"></i></a>
    </div>
    <div class="sharing-twitter">
        <a data-shareto="<?php _e('Twitter', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="https://twitter.com/home?status=<?php echo urlencode( get_the_title() ); ?>%20-%20<?php echo wp_get_shortlink() ?>"><i class="fa fa-twitter"></i></a>
    </div>
    <div class="sharing-pinterest">
        <a data-shareto="<?php _e('Pinterest', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="#" data-href="https://pinterest.com/pin/create/button/?url=<?php echo wp_get_shortlink() ?>&amp;media=<?php echo esc_url( $featured_img ); ?>&amp;description=<?php echo urlencode( get_the_title() ); ?>"><i class="fa fa-pinterest"></i></a>
    </div>
    <div class="sharing-linkedin">
        <a data-shareto="<?php _e('Linkedin', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo wp_get_shortlink() ?>&amp;title=<?php echo urlencode( get_the_title() ) ?>&amp;summary=<?php echo urlencode( wp_strip_all_tags( get_the_excerpt() )) ?>&amp;source=<?php echo urlencode( get_bloginfo( 'name' ) ) ?>"><i class="fa fa-linkedin"></i></a>
    </div>
</div>

你能告诉我应该怎么做才能在Reddit和Tumblr上添加分享选项吗?

非常感谢你对我的帮助。

顺便说一句,我正在使用主题"Falive“,但他们不提供支持选项来优化外观。我尝试复制其他类的代码行,但都不起作用。

EN

回答 2

Stack Overflow用户

发布于 2019-12-07 14:13:13

我已经编辑了你的代码并添加了reddit & tumblr分享,希望对你有所帮助。

代码语言:javascript
复制
<div class="sharing">
    <div class="sharing-facebook">
        <a data-shareto="<?php _e('Facebook', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo wp_get_shortlink() ?>"><i class="fa fa-facebook"></i></a>
    </div>
    <div class="sharing-twitter">
        <a data-shareto="<?php _e('Twitter', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="https://twitter.com/home?status=<?php echo urlencode( get_the_title() ); ?>%20-%20<?php echo wp_get_shortlink() ?>"><i class="fa fa-twitter"></i></a>
    </div>
    <div class="sharing-pinterest">
        <a data-shareto="<?php _e('Pinterest', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="#" data-href="https://pinterest.com/pin/create/button/?url=<?php echo wp_get_shortlink() ?>&amp;media=<?php echo esc_url( $featured_img ); ?>&amp;description=<?php echo urlencode( get_the_title() ); ?>"><i class="fa fa-pinterest"></i></a>
    </div>
    <div class="sharing-linkedin">
        <a data-shareto="<?php _e('Linkedin', 'jeg_textdomain') ?>" rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo wp_get_shortlink() ?>&amp;title=<?php echo urlencode( get_the_title() ) ?>&amp;summary=<?php echo urlencode( wp_strip_all_tags( get_the_excerpt() )) ?>&amp;source=<?php echo urlencode( get_bloginfo( 'name' ) ) ?>"><i class="fa fa-linkedin"></i></a>
    </div>
    <div class="sharing-tumblr">
        <a data-shareto="tumblr" rel="nofollow" target="_blank" href="http://www.tumblr.com/share/link?url=<?php echo wp_get_shortlink() ?>"><i class="fab fa- tumblr"></i></a>
    </div>
    <div class="sharing-reddit">
        <a data-shareto="reddit" rel="nofollow" target="_blank" href="https://www.reddit.com/r/test/submit?title=<?php echo the_title() ?>&url=<?php echo wp_get_shortlink() ?>"><i class="fab fa-reddit"></i></a>
    </div>
</div>
票数 0
EN

Stack Overflow用户

发布于 2019-12-08 16:25:08

你可以使用wordpress网站的AddtoAny插件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59222669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档