Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Cómo añadir botones sociales en WordPress feed RSS

Después de nuestro artículo que recomendaba a los usuarios dejar de usar Feedburner, muchos usuarios nos preguntaron cómo podían conseguir los botones para compartir en redes sociales que tenían en sus feeds de FeedBurner. Mientras que la mayoría de los lectores de feeds modernos incluyen capacidades para compartir en redes sociales, en este artículo, le mostraremos cómo añadir botones sociales en el feed RSS de WordPress.

Social sharing buttons displayed in WordPress RSS Feed

Lo primero que debe hacer es descargar los botones sociales que desea mostrar en sus feeds. Hay varios conjuntos de iconos de medios sociales disponibles de forma gratuita. Elige el que mejor se adapte a tus necesidades. Después tienes que ir a Medios ” Añadir nuevo y subir los iconos de Facebook y Twitter a tu biblioteca de medios.

Upload social media icons to WordPress Media Library

Una vez subidos los iconos, tienes que copiar su URL de ubicación. Simplemente ve a Medios ” Biblioteca y haz clic en el enlace Editar debajo del icono de Twitter.

Edit social icon files

En la página Editar medios, copia la URL del archivo y pégala en un editor de texto. Repite el proceso también para el icono de Twitter. Necesitaremos estas URL más adelante.

Get the icon file URL

Utilizaremos el filtro de contenido por defecto de WordPress para añadir estos iconos debajo de cada entrada en su feed RSS de WordPress.

Tienes que añadir este código en el archivo functions. php de tu tema o en un plugin específico del sitio.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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 .= '<p>
<a href="http://www.facebook.com/sharer/sharer.php?u=' . $permalink_encoded . '" title="Share on Facebook"><img src="Facebook icon file url goes here" title="Share on Facebook" alt="Share on Facebook" width="64px" height="64px" /></a>
 
<a href="http://www.twitter.com/share?&text='. $post_title . '&amp;url=' . $permalink_encoded . '" title="Share on Twitter"><img src="Facebook icon file url goes here" title="Share on Twitter" alt="Share on Twitter" width="64px" height="64px" /></a>
</p>';
}
 
return $content;
}
 
add_filter('the_excerpt_rss', 'wpb_add_feed_content');
add_filter('the_content', 'wpb_add_feed_content');

Este código simplemente añade HTML para mostrar iconos sociales debajo del contenido de las entradas en tus feeds RSS de WordPress.

Esperamos que este artículo te haya ayudado a añadir botones sociales en tus feeds RSS de WordPress.

Si te ha gustado este artículo, suscríbete a nuestro canal de YouTube para ver nuestros tutoriales en vídeo sobre WordPress. También puedes encontrarnos en Twitter y Google+.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

9 comentariosLeave a Reply

  1. Moeen Ahmed Sultan

    Hi, it’s a very good article and I have implemented this. I want to know about linkedin, whatsapp, email, print, google+ and other social networks sharing button? And want to know about how to add these buttons below articles as well.

    Regards

    • WPBeginner Support

      While we don’t have these at the moment, we will certainly take a look at possible methods

      Admin

  2. Sacha

    Another great option would be to just add these in the SEO > Advanced > RSS with the Yoast SEO plugin.

    • Yves

      Works without any issue on Genesis.

  3. Hmache Abdou

    didn’t work for me! :'(

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.