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

Como adicionar o botão oficial de compartilhamento do LinkedIn no WordPress

Nota editorial: Ganhamos uma comissão de links de parceiros no WPBeginner. As comissões não afetam as opiniões ou avaliações de nossos editores. Saiba mais sobre Processo editorial.

Deseja adicionar o botão de compartilhamento oficial do LinkedIn no WordPress? Há muitos plug-ins de mídia social que permitem adicionar botões de compartilhamento, mas a maioria deles não usa os botões oficiais. Neste artigo, mostraremos a você como adicionar o botão oficial de compartilhamento do LinkedIn no WordPress.

Adding LinkedIn share button in WordPress

Adição do botão oficial de compartilhamento do LinkedIn no WordPress

Para este tutorial, você precisará editar seus arquivos de tema do WordPress. Se você não tiver feito isso antes, consulte nosso guia sobre como copiar e colar código no WordPress.

Primeiro, você precisa visitar a página do LinkedIn Share Plugin. Você será solicitado a selecionar o idioma do seu site e o estilo de botão que deseja usar.

Você pode deixar o campo URL em branco porque o botão de compartilhamento pode obter automaticamente o URL da página.

Em seguida, você precisa clicar no botão “Get Code” para copiar o código do botão de compartilhamento do LinkedIn.

Copy the LinkedIn share button code

Agora que obtivemos o código de compartilhamento, vamos adicionar os botões oficiais em seu site do WordPress.

Exibir o botão de compartilhamento do LinkedIn em publicações e páginas do WordPress

Se quiser exibir o botão de compartilhamento do LinkedIn antes do conteúdo do seu post, você pode usar o código a seguir. Você precisará copiar e colar esse código no arquivo functions.php do seu tema ou em um plug-in específico do site.

function wpb_linkedin_share_before($content) { 
// Share code you copied from LinkedIn goes here
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>'; 
$newcontent = $sharecode .$content; 
return $newcontent; 
} 
add_filter('the_content', 'wpb_linkedin_share_before');

Você pode salvar suas alterações e visitar seu site para vê-las em ação.

LinkedIn Share button in action

Se quiser exibir o botão de compartilhamento após o conteúdo da publicação, será necessário adicionar o seguinte código.


function wpb_linkedin_share_after($content) { 
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>'; 
$newcontent = $content . $sharecode; 
return $newcontent; 
} 
add_filter('the_content', 'wpb_linkedin_share_after');

Você também pode adicionar o código do botão de compartilhamento do LinkedIn que copiou anteriormente diretamente em um widget HTML personalizado do WordPress. Basta acessar a página Appearance ” Widgets e adicionar o widget “HTML personalizado” a uma barra lateral.

Em seguida, adicione o código do botão Compartilhar do LinkedIn dentro do widget HTML personalizado e clique no botão Salvar para armazenar suas alterações.

Linkedin button in a sidebar widget

Agora você pode visitar seu site para vê-lo em ação.

LinkedIn share button in sidebar

Esperamos que este artigo tenha ajudado você a aprender como adicionar facilmente o botão oficial de compartilhamento do LinkedIn no WordPress. Talvez você também queira ver nossa lista dos melhores plug-ins do LinkedIn para WordPress.

Se você gostou deste artigo, inscreva-se em nosso canal do YouTube para obter tutoriais em vídeo sobre o WordPress. Você também pode nos encontrar no Twitter e no Facebook.

Divulgação: Nosso conteúdo é apoiado pelo leitor. Isso significa que, se você clicar em alguns de nossos links, poderemos receber uma comissão. Veja como o WPBeginner é financiado, por que isso é importante e como você pode nos apoiar. Aqui está nosso processo editorial.

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.

O kit de ferramentas definitivo WordPress

Obtenha acesso GRATUITO ao nosso kit de ferramentas - uma coleção de produtos e recursos relacionados ao WordPress que todo profissional deve ter!

Reader Interactions

29 ComentáriosDeixe uma resposta

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Sanket Bhardwaj says

    Hey, Thanks for providing this code. I have added this button on my website but now when i want to remove this It came back again and again. I have removed the code from functions.php but it came again and again.
    Please help Me.

  3. Gabriela says

    Anyone know why when you share your blog here in WordPress to LinkedIn, there is no picture attached? I do have one but it disappears when I try to share it to LinkedIn. I shared it in Facebook and Twitter and it works good but not in LinkedIn, The text appears good but no picture. I don’t get it. Tips? Thank you!

  4. Emily says

    Does anyone know of a way to add the LinkedIn share button to a “free” wordpress, for which I own the domaine? Not sure if this matters, but I think maybe the other company is “hosting” the wordpress page. Anyway, I’ve tried the text widget and adding the html to the end of a blog post. Don’t think either is working because I just get a weird looking hyperlink that takes someone to a page of text….

  5. Electra Ford says

    Hi,

    I’ve added the code but it’s not showing for me. Any new updates on how to get the LinkedIn share button to display?

    Thanks

  6. sinhrakesh says

    I used below codes in the Custom Codes section to add Google+ and Linkedin Share buttons on my WP Blog (www.maintec.com/blog):

    Google+

    <div class=”sharer”><script type=”text/javascript” src=”https://apis.google.com/js/plusone.js”></script> <g:plusone size=”tall”></g:plusone></div>

    Linkedin

    <div class=”sharer”><script type=”text/javascript” src=”http://platform.linkedin.com/in.js”></script><script type=”in/share” data-url=”<?php the_permalink(); ?>” data-counter=”top”></script></div>

    Google+ Button is working fine but Linkedin Share isn’t getting the desired result upon clicking… Can you please advise whats wrong where?

  7. wpbeginner says

    You are welcome. Yes horizontal one works great, but if you have a floating share box like ours, then the vertical share box is good too.

  8. Keith Aul says

    I’m not to sure what you mean by the following?
    To add the Official Linkedin Share button simply open up a theme file of your choice (single.php etc) and add the following code within the Post Loop

    I don’t want to break anything on my site so I want to be sure I’m able to find the right file and open/edit it. Where would I find the theme file in my dashboard and where in the file do I post the code?

    • Editorial Staff says

      You will find the theme file in your theme’s folder wp-content/themes/yourthemename/ < Editor and edit single.php file. If you have no knowledge regarding WordPress, then we recommend that you wait till a plugin comes out.

      Administrador

  9. Piet says

    Finally LinkedIn did this, a week too late though, but I managed to make something similar for myself.
    Next time I need it, I will just grab your code, thanks!

    • Jose Joel says

      The Share This Plugin have the option to add the LinkedIn Button as simple as writing linkedin the editing section of the plugin…and this one have count… ;)

      Note: I’m not the developer of this plugin, neither work for them, I’m only a regular user… :)

  10. Jon Bishop says

    I’m happy LinkedIn finally did this. I tried to use their API to make my own for the Socialize plugin but it ended up being a pain. I was able to finally use this code to update the plugin with the new LinkedIn button.

Deixe uma resposta

Obrigado por deixar um comentário. Lembre-se de que todos os comentários são moderados de acordo com nossos política de comentários, e seu endereço de e-mail NÃO será publicado. NÃO use palavras-chave no campo do nome. Vamos ter uma conversa pessoal e significativa.