Once Coupled
  • About Us
    • Confident
    • Charming
    • Champion
  • Ongoing Support
  • Work With Us!
Home » Welcome » Moving post signature above related content and share buttons
Home » Welcome » Moving post signature above related content and share buttons

Moving post signature above related content and share buttons

Author:

Lauren Gray

Published:

February 5, 2014
November 27, 2015

This site runs ads and generates income from affiliate links. Read my disclosure policy.

Feature Fest is your 6-day crash course to train your team (or future team) and finally glow up your site.

Join Feature fest

Now that we know about hook priorities and how we can use them to set the order of importance for our page elements, let’s apply that knowledge to our signature, and making sure that we can insert our signature after our content but before our share buttons and related content. We’ll be moving post signature above related content and share buttons.

I’m going to show you how to work with the Shareaholic plugin, but if you’re using the nRelate plugin, head over to 1dogwoof.com for how to set the display priority. Here we go!

Getting the shortcode

If you’ve already had Shareholic installed, you’ve got it all set up and are probably having it inserted automatically. In order to assign where this plugin displays, we need to turn that setting off, and use our functions to insert the shortcode manually. So let’s grab our shortcode for later.

sh1

Go to your WordPress Dashboard > Shareaholic and click on the ‘Customize’ button. At the bottom, there’s a shortcode. Copy that! That ID is specific to your content, so it’s what you need to have – unless you want to be linking to my content, which I’m OK with!

sh2

Putting the code in functions.php

We already have our signature in our functions file, but we want to assign a priority to it.

//*  Add a post signature
add_filter( 'genesis_entry_content', 'post_signature', 10 );
function post_signature() {
     if ( is_single() ) {
          printf ('<div class="post-signature' . get_the_author_meta('user_login') . '"> </div>'); 
     } 
}

Great, now let’s put that shortcode in, making sure we give it a higher priority!

//* POSTS  Move related content below signature
add_filter( 'genesis_entry_content', 'shareaholic_related', 12 );
function shareaholic_related() {
     if ( is_single() ) {
	echo do_shortcode ('[shareaholic app="recommendations" id="4802086"]');
     } 
}

Just make sure you’re replacing that ID number with your own!

Think you can duplicate the code above but change it just a bit to include your share buttons? Try! A solution is below:

//* POSTS  Move related content below signature
add_filter( 'genesis_entry_content', 'shareaholic_buttons', 11 );
function shareaholic_buttons() {
     if ( is_single() ) {
	echo do_shortcode ('[shareaholic app="share_buttons" id="4802082"]');
     } 
}

How’d you do? I know, I know, I haven’t taught you all the secrets yet. Well, the main takeaway is that you just need to change the priority and then the shortcode to reflect the share buttons. But if you tried it out and got an error, it’s probably because you didn’t change the function name. Those can only be used once. Anyway, good job! 🙂

pssst.. Check out our sister brands!

Small Plugins: optimized custom blocks
Creator Theme: DIY version (coming soon)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2 responses

  1. Laurel
    February 12, 2014

    Did Shareaholic change something in their plugin? I want to add it to a second site and now can’t find where to personalize my Twitter name.

    Reply
  2. Laurie
    February 13, 2014

    This was a great tutorial post. I have a signature that I made due to a post similar to yours.

    Reply

Hey, we’re Once Coupled!  We empower publishers to create great content without tech headaches.

  • YouTube
  • TikTok

Customization Tiers

Confident
Charming
Champion

Our Brands

Contact Once Coupled
Creator Theme
Small Plugins

Legal

Privacy Policy
Disclosure Policy
Cookie Policy