WordPress.org

Ready to get started?Download WordPress

Forums

Share Buttons by AddThis
[Plugin: AddThis featuring Sharing Buttons / Facebook Like / Tweet Button] Manually adding to a temp (6 posts)

  1. Rob
    Member
    Posted 3 years ago #

    I have a WordPress template that has a form in it. But the page content needs to appear above the form and therefore so does the AddThis options. But I want them below the form. I can turn them off via the post meta options but how then do I add it to the correct place in my template.

    I have tried <?php do_action( 'addthis_widget', $url, $title); ?>. It adds it but not the button options I'm using.

    Anyone have any ideas I could try?

    http://wordpress.org/extend/plugins/addthis/

  2. Aaron Jorbin
    Member
    Posted 3 years ago #

    Hi Rob,

    You can pass in a fourth paramater which is the key inside the $addthis_new_styles array (approximently line 46 in the plugin file), or alternativly you can download the development version from http://wordpress.org/extend/plugins/addthis/download/ which allows you to pass in 'above' or 'below' to use what is set in the backend as above or below. If you do this you should remove the normal below/above placement. To do that use the following code in your theme's functions.php file:

    add_filter('addthis_above_content', 'my_plugin_addthis_above_content');
    function my_plugin_addthis_above_content()
    {
        return '';
    }

    You should change 'above' to 'below' if you want to do it below the post. And also change the my_plugin prefix to something that makes more sense for you.

    Does that answer your question?

  3. Rob
    Member
    Posted 3 years ago #

    Hi, thanks, that kind of helps, I'm closer. But you lost me on the above/below functions.php bit. And I'm not sure I need to do that.

    The AddThis options I have set (below the post, custom buttons) work fine on all pages except where I have a template that has some additional content going on below <?php the_content() ?>. So on those pages I have turned off AddThis via the post meta options. So now I want to add it manually into the template in the right position.

    I understand the 4th parameter bit. So if I have <?php do_action( 'addthis_widget', $url, $title, 'share_counter'); ?> in the correct place in my template the share_counter style of button appears.

    But I am using the custom option. So what do I replace share_counter with?

    Thanks.

  4. Rob
    Member
    Posted 3 years ago #

    Has anybody any ideas about my last question? I'm still unable to get this right. Thanks.

  5. Aaron Jorbin
    Member
    Posted 3 years ago #

    You can pass in array. The array should be an associative array and looks for four parts

    * size - either 16 or 32. Defaults to 16 (if anything other then 32 is entered, it defaults to 16)
    * services - lower case comma sepperated list of services (string)
    * preferred - number of Prefered services to be displayed after listed services (int)
    * more - bool to show or not show the more icon at the end (bool)

  6. Rob
    Member
    Posted 3 years ago #

    Hi, could you give me an example of the code please so I can amend as necessary. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags