Customize Shareaholic Location on Individual WordPress Pages

In some cases, you may want to add our apps in a specific location on your webpage other than the auto-placement done by the plugin. You may also want to set custom look/feel and settings for buttons on a particular page. 

You can do this with the app Shortcode (which is WordPress' method for truncating content code for plugin developers) and paste it in the page template wherever you want it to appear. 

How to Install Shareaholic in Specific Locations on WordPress Pages 

STEP ONE - Get the code

  • In the Shareaholic App Manager, click any of the Customize buttons for Related/Promoted Content or Share Buttons. 
  • The shortcode containing the app's unique id number is displayed at the bottom of the Edit panel.
  • Copy this code.
  • Locate the page template where you want to install our apps and paste the shortcode wherever you want the app to appear on the page (see below for detailed instructions).

Example Shortcode:

Share Buttons

[shareaholic app="share_buttons" id="xxxxx"] 

Related/Promoted Content

[shareaholic app="recommendations" id="xxxxx"]


STEP TWO: Customize what is Shared (optional)

You can tell Shareaholic what specific details to include when people share your content by adding "Data Attributes" within the shortcode. Right now, you can customize the page Title, Link and Summary using the following template:

Share Customizations

 title="This is my Page Title"

 link="http://www.TheURLtoShare.com/page.html"

 summary="You can place your own description of the page here."

What is looks like in the shortcode

[shareaholic app="share_buttons" id="xxxxx" title="Title of the Page being Shared" link="http://www.TheURLtoShare.com/page.html" summary="This is a description of the page that will be shared."]


STEP THREE: Insert the Code

There are three methods you can use to manually insert our apps into your WordPress site. Select the method that meets your needs and follow the instructions provided.

  1. Add Shareaholic into your templates
  2. Add Shareaholic as a sidebar widget
  3. Add Shareaholic within select content

Templates

The most commonly used method for customizing app placement is to add the app directly into your theme's template. This ensures that our apps appear for all content where this template loads.

(I recommend any changes made to a theme be applied via a child theme. This allows you to customize the theme without actually modifying the default template files.)

How to access your template files

There is an editor built into your WordPress Admin that you can use to edit your page templates. You can locate it by going to Appearance > Editor

You'll see a dropdown menu at the top-right where you can select which theme you would like to edit, and beneath this is a list of all files used to render the theme (templates and stylesheets).

When you select one of the files, it opens in the edit box to the left. Because themes and content layout vary from site to site, if you are having trouble determining which template files to modify, you may find this list helpful in identifying what each file does.

Once the appropriate file has been opened, you are likely to be a bit overwhelmed if unfamiliar with PHP. Don't let this intimidate you. At some point, most publishers will find themselves editing something in their theme, and first times are always scary. If you are working with a child theme (which you should be), don't worry about messing anything up. You can easily start over if something goes wrong.

Where to place the Shareaholic shortcode

In the edit box, scan the content of the file to see if you recognize any keywords that are indicative of where you are when viewing the template, such as entry or loop or comments. You can even use Google for help if you get stuck.

How to add the Shareaholic shortcode 

To insert any of your Shareaholic configured apps into your template files, use the following structure:

<?php echo do_shortcode('[shareaholic shortcode]'); ?>

Example:

<!-- Shareaholic Share Buttons -->

<?php echo do_shortcode('[shareaholic app="share_buttons" id="xxxxx"]'); ?>

Note: If you don't see the updates right away, clear all caches in any caching plugins (e.g., W3 Total Cache, WP Super Cache) along with your browser's cache.

Adding our apps into your template is the most difficult manual insertion method, but it is often utilized with custom post types or when you would like to include our apps in the header or footer of your site.


Widget

In some cases, you may want to add our apps in your website sidebar. There is a plugin named Enhanced Text Widget that allows you to add our apps to your sidebar using the same shortcode you created above.

  1. Install the Enhanced Text Widget
  2. Click on Appearance > Widgets 
  3. Drag and drop the Enhanced Text widget wherever you want the Shareaholic Buttons and/or Related Content to appear.
  4. Paste the Shareaholic shortcode directly into the widget Content box and click Save.

Widget Screen

Note: If you don't see the updates right away, clear all caches in any caching plugins (e.g., W3 Total Cache, WP Super Cache) along with your browser's cache.

In Content

We do offer options to disable plugin features on individual pages and posts, and these controls work for content that uses your standard post and page templates (but not for custom post types) if the content is automatically placed by our plugin.

One of the shortcode features is that you can include it directly in a Page/Post edit box. Just switch to the Text tab and paste the shortcode anywhere within your content (e.g., above, below, middle). 

edit-post-insert-app.png

Reasons to add Shareaholic directly into content

  1. You want to include our apps multiple times in a post
  2. You'd like to prompt readers to share multiple times in a post (good for longer posts)
  3. You may want to add Related Content in the middle of your post to encourage page surfing so that they'll stay on your site longer.
  4. You want multiple Share Button styles on the same page

apps-within-content.png

Have more questions? Submit a request

Comments

Article is closed for comments.