How to add Twitter, Facebook, and Google+ to your PressWork themeAlex
Unless you’ve been living under rock, you know how important it is to add share buttons to your blog or site to generate more traffic and help build a community around your brand, product, or point of view.
There are many plugins and widgets for WordPress that will add various share buttons, but adding a plugin or widget is not always the answer. It’s very easy, using PressWork, to add Twitter, Facebook, and Google+ to you theme with a few simple lines of code that take advantage of PressWork’s powerful custom actions.
I highly recommend that you read these docs to understand the first steps you need to take:
Using the Toolbox
One of the things that makes PressWork so powerful is it’s front-end editor, the Toolbox. With the Toolbox you can quickly and easily customize your site in minutes without using any code. However, if you’re a developer or have a basic understanding of WordPress theming, the Toolbox offers a bunch or really powerful features like Hooks and Functions.
To help us add our share buttons we’re going to take advantage of the Hooks feature located in the first panel of the Toolbox “Settings”. Under Settings you can turn Hooks on. This will display guides that show you all the different actions you can hook into.
With Hooks turned on let’s take a look at a single post page.
So, if want to add the share buttons to the bottom of each post we need to hook into pw_single_post_bottom.
Adding the code
Add the following code to your child theme’s actions.php file or your custom-actions.php file: