Easily add Facebook and Twitter counters without using plugins

Facebook and Twitter Buttons Without Plugins

| 6 Comments

Facebook and Twitter buttons are all the rage lately, providing an easy way for your readers to quickly share your posts on the social media sites with nothing more than a click, as well as seeing who else has done the same. Take note that these counters are different from the Facebook Like Button.

Fortunately, adding these buttons is very simple and requires little technical skill.

Using ShareThis to do the leg work

To add the Facebook counter to your website, all you need to do is add a little code to two of your theme files (header.php and single.php). To get the specific code for your website, head over to ShareThis and follow these instructions:

  1. Select “Any website”
  2. Choose “Horizontal Counters” (or other if you would prefer)
  3. Select the style on the left (not the ShareThis button)
  4. Hit “Get The Code Already”
  5. You’ll now be prompted to register an account – it’s quick, easy and spam-free.
  6. The next page will give you two lots of code: the top piece of code needs to be inserted in single.php, wherever you want the button to appear (probably before or after the content). However, if you don’t want their email and share buttons, just remove the following from the end of the code provided:

The second piece of code needs to inserted in your header.php file – just before the tag will do perfectly.

It’s as simple as that. Now refresh one of your posts and check that it’s working properly.

Categories: Code & Snippets, Social Media | Permalink

What next?

Hire me

If you couldn't quite manage this yourself, find it too intimidating, or just don't have the time to do it, you can always hire Dave to do it. Please get in touch so that we can discuss your needs.

Leave a comment

If you have a question, update, or comment about the tutorial, please leave a comment. I try and respond to every comment, though it may take a few days, so please check back soon.

Let a WordPress Expert help you

Do you want to try this, but feel like you need a helping hand, in case something goes wrong? My service, The WP Butler, gives you access to WordPress expertise whenever you need it. Better yet, I'll keep your site backed up, updated and secure, so that you don't have to worry about it. It's all part of the service. Use coupon DIWW and save 15% on all plans.

Visit The WP Butler

Author:

Dave has been tinkering with WordPress for many years, and he now shares his WordPress knowledge here on Do It WIth WordPress to help others realise its impressive power. He can also be hired to help with your WordPress needs. Dave, who is British, is married to his best friend, Marti, with whom he has a beautiful daughter, Ellie. When he's not dabbling with WordPress, he's probably eating Triscuits or hummus, watching an indie film or British TV show, spending time with friends or family, or exploring the world.

6 Comments

  1. Thanks for the post/tutorial. Now i don’t need to use any plugins. However i like the plugin i am currently using as it does everything for me and its automatic. :)

  2. hey i just went through your recent email with how to’s it was great, however having one question, I always did have a hard time with RSS feeds. I have social buttons and have nothing in my site bar like you to subscribe to a RSS feed for my site…help if you can or suggestions? thanks

    • Hi there,

      I was just having a look over at your site and I’m not sure which part of my site you’re referring to, but I do see an RSS icon above your navigation bar (kind of peeking out of it), in your sidebar and at the bottom of every post. In short, you want to provide ample opportunity for readers to sign up to your RSS feed. On my site for instance, there’s a link in the header, the sidebar and by auto-discovery (if supported by the viewer’s browser).

      I think you’ve got plenty of opportunities for people to sign up to your RSS feed, unless I’m misunderstanding your question. Let me know if you have any more questions, or want help integrating a new approach.

      And thanks for the kind words about Do More With WordPress. Much appreciated!

  3. Thanks! I had been looking all over trying to figure out a nice way to add Twitter and Facebook chicklet counters to each post and it was driving me up the wall. Now it seems so simple.

Leave a Reply