WordPress.org

Ready to get started?Download WordPress

Forums

ShareThis: Share Buttons and Social Analytics
Can I put manually in the pages? (10 posts)

  1. Tzita
    Member
    Posted 1 year ago #

    Hi,
    Sharethis buttons only appear in one page, why?
    And, can I put manually the logos where I want?

    Thanks.

    http://wordpress.org/plugins/share-this/

  2. sharethissupport
    Member
    Posted 1 year ago #

    [ Moderator note: please wrap code in backticks or use the code button. ]

    Hello user,

    Can you please provide us your website details so that we can debug the issue?

    Yes, you can add the ShareThis buttons to your website manually. But please note that manual installation can be done after removal of previously installed ShareThis Plugin from WP.
    Its a bit tricky procedure.

    ShareThis widget code can be obtained from here: http://www.sharethis.com/publishers/get-sharing-button
    By selecting "Website" as a Platform follow the steps till you get the ShareThis widget code.

    In order to add the buttons at the top of each post, please go through the instructions below. You can add the buttons in a way you want by following these instructions.
    --
    Sharethis script and span tags go on the page where you want the buttons to appear and they also determine what kind of button appears as well as what URL and title it shares. You will have to put 'script tags' in your Main index template(index.php) and 'span tags' in Single Post template(single.php).

    Here is the basic span for just the ShareThis button:

    <span class="st_sharethis" st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText="ShareThis"></span>

    You can change the class of the span to determine the button that appears. For example class="st_twitter" will make a twitter icon and class="st_email_vcount" will make a email vertical counter button.

    However, adding code in index.php and single.php will not display sharethis buttons on the blog page but will show buttons whenever an individual post is opened.
    If you wish to display sharethis buttons on the blog page ,you will have to put 'span tags' in (loop.php).

    In loop.php,
    1. put span tags just above the line "<div class="entry-utility">" to display buttons at the end of each post on the blog page.

    <span  class='st_sharethis' ></span>
       <div class="entry-utility">

    2. to display buttons at the beginning of each post on the blog page,put span tags just below the lines

    <h2 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
       <div class="entry-meta">
        <?php twentyten_posted_on(); ?>
       </div><!-- .entry-meta -->
    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>

    If you face any issues during implementation, feel free to contact us.

  3. iversoncru
    Member
    Posted 1 year ago #

    thanks for the help sharethissupport,
    I could not get it to work with your explanation but i got it with the code provided under "Website" in the URL you provided http://www.sharethis.com/publishers/get-sharing-button

    very easy, thanks!

  4. pwillmott86
    Member
    Posted 10 months ago #

    Hi Share This,

    This question is in relation to website: http://www.patrickwillmott.com

    In Step 4 "Additional Features" of the configuration settings, there are two options that say:

    1 - Automatically add ShareThis to your posts? Yes/No
    2 - Automatically add ShareThis to your pages? Yes/No

    For both I have put No.

    When I create a post that I want to manually add share this to the bottom of the post.

    The reason being, the blog page feature box is a Blog Post. So Share This puts the share icons in the feature box if i select Yes to "Automatically add ShareThis to your posts?"

    I can think of one of two options that can fix my problem...can you please help.

    1 - Inside a new blog Post, have a screen option that allows you to tick Yes include Share This icons. (Default would be no)

    2 - Provide a way to remove it from a single post (My Feature Box Post).

    Thanks,
    Patrick Willmott
    LIVE

  5. sharethissupport
    Member
    Posted 10 months ago #

    Hello Patrick,

    Thank you for your suggestion.
    We will forward your suggestion to our engineering team for further action. The new features will be available in the future implementation/update of WP Plugins. Till the time, you can add the ShareThis code manually to your site and place them exactly as per your requirements.

  6. maccast
    Member
    Posted 7 months ago #

    If it helps I have been trying to figure out how to use the WordPress ShareThis plug-in but still be able to manually position the ShareThis button within my templates. This is how I am currently making it work. I have not tested it outside my development environment, but it seems to work so far. The basic idea is this:

    1) Disable the built in calls to ShareThis that insert the buttons automatically on pages and posts (they do this with a call to add_filter('the_content', 'st_add_widget'); around line 285 in the sharethis.php file in the plugin).

    2) create my own action that can be called to insert the ShareThis widget where I want in my template.

    3) Do all this in functions.php so I don't have to hack the plug-in or WordPress core. Doing it this way should allow WP and plug-in updates to run without any future issues.

    Solution
    Added this to my functions.php

    //remove share this from all content
    function remove_sharethis() {
      remove_filter('the_content', 'st_add_widget');
      remove_filter('the_excerpt', 'st_add_widget');
      remove_action('wp_head', 'st_widget_head');
    }
    add_action( 'template_redirect', 'remove_sharethis' );
    
    function print_sharethis_widget( ){
        print st_widget_head();
        print st_add_widget('');
    }
    add_action( 'custom_sharethis_widget','print_sharethis_widget');

    Then in my templates I call the custom_sharethis_widget action where I want the ShaeThis buttons to appear. like this:

    <div id="my-sharethis"><?php do_action( 'custom_sharethis_widget' ); ?></div>

    It took me a while to work this out, so hopefully this helps someone else out.

  7. WP Sites - Brad Dalton
    Member
    Posted 7 months ago #

    Adam, appreciate your work on this but it involves modifying the plugins code.

  8. helgatheviking
    Member
    Posted 6 months ago #

    @Sharethissupport : I can also say that a template tag would be very practical.

  9. maccast
    Member
    Posted 6 months ago #

    @Brad Dalton Hopefully I didn't confuse things with my intro. I did not actually modify the sharethis.php file, nor did I touch the plug-in in any way directly. I was just pointing out where the line in their code was that I needed to override for my solution to work. I am using remove_filter() calls in my templates function.php file to disable the default plugin behavior and then creating my own print_sharethis_widget function to insert the ShareThis code where I want it in my template. Hope this makes it clearer.

  10. sharethissupport
    Member
    Posted 5 months ago #

    @ helgatheviking
    We will forward this to our tech team.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.