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

Como adicionar botões sociais no feed RSS do WordPress

Depois do nosso artigo que recomendava que os usuários parassem de usar o Feedburner, muitos usuários nos perguntaram como poderiam obter os botões de compartilhamento social como tinham em seus feeds do FeedBurner. Embora a maioria dos leitores de feed modernos inclua recursos de compartilhamento social, neste artigo, mostraremos como adicionar botões sociais no feed RSS do WordPress.

Social sharing buttons displayed in WordPress RSS Feed

A primeira coisa que você precisa fazer é baixar os botões sociais que deseja exibir em seus feeds. Há vários conjuntos de ícones de mídia social disponíveis gratuitamente. Escolha um que melhor atenda às suas necessidades. Depois disso, vá para Mídia ” Adicionar novo e carregue os ícones do Facebook e do Twitter na sua biblioteca de mídia.

Upload social media icons to WordPress Media Library

Depois de carregar os ícones, você precisa copiar o URL de localização deles. Basta ir para Mídia ” Biblioteca e clicar no link Editar abaixo do ícone do Twitter.

Edit social icon files

Na página Editar mídia, copie o URL do arquivo e cole-o em um editor de texto. Repita o processo para o ícone do Twitter também. Precisaremos desses URLs mais tarde.

Get the icon file URL

Usaremos o filtro de conteúdo padrão do WordPress para adicionar esses ícones abaixo de cada publicação em seu feed RSS do WordPress.

Você precisa adicionar esse código no arquivo functions.php do seu tema ou em um plug-in específico do site.

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');

Esse código simplesmente adiciona HTML para exibir ícones sociais abaixo do conteúdo do post em seus feeds RSS do WordPress.

Esperamos que este artigo tenha ajudado você a adicionar botões sociais em seus RSS Feeds do WordPress.

Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para receber nossos tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no 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 ComentáriosLeave 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.