当前位置:网站首页 > WordPress教程 > 正文
如何在WordPress RSS提要中添加社交按钮
作者:98wpeu发布时间:2024-01-19分类:WordPress教程浏览:723
导读:在我们的文章建议用户停止使用Feedburner之后,许多用户问我们如何才能像他们在FeedBurner提要上那样获得社交分享按钮。虽然大多数现代提要阅读器都包含社交分享功能,但在...
在我们的文章建议用户停止使用Feedburner之后,许多用户问我们如何才能像他们在FeedBurner提要上那样获得社交分享按钮。虽然大多数现代提要阅读器都包含社交分享功能,但在本文中,我们将向您展示如何在WordPress RSS提要中添加社交按钮。
![]()
你需要做的第一件事是下载你想要显示在你的提要中的社交按钮.有几套社交媒体图标是免费提供的.选择一个最适合你需要的.在那之后,你需要去媒体»添加新内容并上传和图标到您的媒体库.
![]()
上传图标后,您需要复制它们的位置URL。只需转到媒体?图书馆并点击编辑下面的链接图标.

在编辑媒体页面上,复制文件url并将其粘贴到文本编辑器中。对图标也重复该过程.我们稍后将需要这些URL。

我们将使用默认的WordPress内容过滤器在您的WordPress RSS提要中的每个帖子下面添加这些图标。
您需要将此代码添加到主题的unctions.php文件或站点特定的插件中。
// add custom feed content
function wpb_add_feed_content($content) {
// Check if a feed is requested
if(is_feed()) {
// Encoding post link for sharing
$permalink_encoded = urlencode(get_permalink());
// Getting post title for the tweet
$post_title = get_the_title();
// Content you want to display below each post
// This is where we will add our icons
$content .= https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'<p>
<a href="http://www.facebook.com/sharer/sharer.php?u=https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/' . $permalink_encoded . https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'" title="Share on "><img src=" icon file url goes here" title="Share on " alt="Share on " width="64px" height="64px" /></a>
<a href="http://www.twitter.com/share?&text=https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'. $post_title . https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'&url=https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/' . $permalink_encoded . https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'" title="Share on "><img src=" icon file url goes here" title="Share on " alt="Share on " width="64px" height="64px" /></a>
</p>https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/';
}
return $content;
}
add_filter(https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'the_excerpt_rsshttps://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/', https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'wpb_add_feed_contenthttps://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/');
add_filter(https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'the_contenthttps://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/', https://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/'wpb_add_feed_contenthttps://www.wpbeginner.com/wp-tutorials/how-to-add-social-buttons-to-wordpress-rss-feed/');
❤️由托管WPCode在WordPress中一键使用
这段代码只是在WordPress RSS提要中的帖子内容下方添加了显示社交图标的超文本标记。
我们希望这篇文章能帮助你在WordPress RSS提要中添加社交按钮。
获取我们的WordPress视频教程。你也可以在和+上找到我们。
- 上一篇:如何将特定帖子添加到WordPress导航菜单
- 下一篇:博客主题下载
相关推荐
- 如何在项目中高效运用react-router-dom和yarn? - Web前端
- 如何在现有 React 项目中添加 TypeScript - Web前端
- 基于JQuery的抓取博客园首页RSS的代码 - Web前端
- 如何在windows服务器上完成安装SSL证书以及HTTPS配置 - Web前端
- 如何在chrome里打印(console)获取数据并转换成json格式 - Web前端
- 如何在Vue种使用类似于Font的SVG图标系统 - Web前端
- 如何在SVG中创建复杂路径 - Web前端
- 如何在HTML5 SVG上绘制三次贝塞尔曲线 - Web前端
- 如何在VS CODE里设置React应用开发的操作和方法 - Web前端
- 如何在MySQL数据库中使用JSON数据字段 - Web前端
- WordPress教程排行
- 最近发表
-
- WordPress 应用:如何修改模版头部文件中的 wp_head() - Web前端
- SEO 优化:YouTube SEO Plugin 提升影片流量 - Web前端
- 使用 React 服务器组件在 Next.js 13 中进行国际化 - Web前端
- 3 个意想不到的技术 SEO 问题示例(以及如何解决它们) - Web前端
- Vue 技术专题:Suspense、路由模式与单元测试实践 - Web前端
- 如何防止 WordPress SQL 注入攻击? - Web前端
- SEO 优化:如何围绕技术SEO框架以构建和制定策略? - Web前端
- SEO优化:YouTube SEO 关键词研究工具 - Web前端
- 2025 年帮助代理机构提升客户业绩的 14 款最佳 SEO 工具 - Web前端
- 客户端:服务器之间设置本地 DNS 服务器 - Web前端


