Display buttons on SOME pages but not ALL pages

emilyfagan1@gmail.com Apr 12, 2013 12:24PM PDT

I would like to display the share buttons on a few of my pages but not all of them. (That is, the buttons with the share counts -- not the hover bar).

Is there a way to do this?

Right now, because I don't want the buttons to appear on all of my pages I have the buttons turned OFF for pages (and ON for posts).

Thanks

http://roadslesstraveled.us

Up 0 Rated Down
ShareThis Support Apr 15, 2013 10:21PM PDT ShareThis Agent
Hello Emily,

It is not possible to control where buttons appear on Wordpress post (location on a page) from ShareThis WP plugin. We can provide you the guidelines on how to achieve this using manual installation of ShareThis code. 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 href="<?php the_permalink(); ?>" 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.
Up 0 Rated Down
emilyfagan1@gmail.com May 03, 2013 04:05PM PDT
Thank you for this response. It's too complicated.

All I want to do is disable the display of the ShareThis buttons on 2 of my pages. It's working fine on all the other 225+ pages and posts on my site.

Easiest would be if you had a Custom Field variable that could be turned on or off --

Disable_ShareThis = Yes

I have been searching to see if anyone had a workaround for this problem and came across this post:

http://wordpress.org/support/topic/share-this-question-1

In it, a representative from ShareThis said that this problem would be addressed soon. Unfortunately, they said that FIVE YEARS ago.

Is there any chance that ShareThis is working on the problem of making it easy to enable/disable the display of ShareThis buttons on a page-by-page and post-by-post basis?

Or is that not really on the agenda right now?

The Lockerz Add-to-Any social sharing plugin does this exact thing very elegantly. However ShareThis is superior in so many other ways... (sigh).

Thank you.
Up 0 Rated Down
ShareThis Support May 06, 2013 05:54AM PDT ShareThis Agent
Hello Emily,

Right now there is no option available to disable the Buttons to show up on the selected pages.

Regards,
The ShareThis Support Team,
support@sharethis.com
Up 0 Rated Down
tara@illuminationgroup.com Jul 19, 2013 03:21PM PDT
I would also like the ability to turn ShareThis on or off on my choice of pages, in a much easier way. The explanantion from ShareThis is too complicated. A lot of us are using WordPress because we are not real heavy coders. Simpler would be better, as Emily Fagan stated above, a good option would be as she says...

Easiest would be if you had a Custom Field variable that could be turned on or off --

Disable_ShareThis = Yes

All I want to do is disable the display of the ShareThis buttons on my homepage - which uses 3 pages. Other than that, I would like ti to appear on all other posts and pages, but in a WYSIWYG way - no heavy coding please.

Please ShareThis - put this update on the agenda. I had to disable ShareThis and go back to Shareholic, although I much prefer ShareThis - I just can't have it show up on the homepage on my WordPress site - it looks really bad.
Up 0 Rated Down
ShareThis Support Jul 26, 2013 04:35AM PDT ShareThis Agent
Hello Tara,

Please try updating the ShareThis settings for wordpress from here:
http://YOUR WP BLOG/wp-admin/options-general.php?page=sharethis.php

as:
Automatically add ShareThis to your posts?* Yes

Automatically add ShareThis to your pages?* No

Please note that the other option is given on the previous post in which you have to add the ShareThis code manually to your website code.
If you have access to your website code then you can add the ShareThis code very easily on the pages where you want the ShareThis buttons to appear.
You can get the code from here -
http://sharethis.com/publishers/get-sharing-button

Please let us know if you have any queries.

Regards,
The ShareThis Support Team,
support@sharethis.com
Up 0 Rated Down
Stephany Gregory Aug 06, 2013 10:19AM PDT
Hi, if i erase the plug in and put it manually will i keep my likes and shares? or will they get lost? www.bienpensado.com
Up 0 Rated Down
Chris Faull Aug 06, 2013 06:12PM PDT
I am new to Wordpress and having a great deal of trouble adding simple ShareThis buttons to the site. I want people to be able to share the page via FaceBook, Twitter and Linkedin. When I automatically insert ShareThis it adds icons scattered throughout the page. With my old HTML site it was a simple matter, but with Wordpress!

Any advice would be welcome.

Chris
Up 0 Rated Down
ShareThis Support Aug 08, 2013 01:54AM PDT ShareThis Agent
Hello Chris,

Please refer these articles which might help you -
http://support.sharethis.com/customer/portal/articles/446440-wordpress-integration#Manual-Installation
http://support.sharethis.com/customer/portal/questions/990421-wordpress-custom-button-location

Regards,
ShareThis Support Team
support@sharethis.com
Up 0 Rated Down
Matthew Milan Aug 30, 2013 12:57PM PDT
One approach to controlling when sharethis widget appears, by category, is this...

Open for editting the share-this/sharethis.php

look for a line not too far down...


// MODIFIES THE CONTENT OF THE PAGE
function st_add_widget($content) {
if ((is_page() && get_option('st_add_to_page') != 'no') || (!is_page() && get_option('st_add_to_content') != 'no')) {
if (!is_feed()) {
return $content.'<p>'.st_makeEntries().'</p>';
}
}
return $content;
}

do not remove anything from this call, instead, add conditional statements to narrow down WHEN and WHERE you allow sharethis to show up.

i use a function that determines my MAIN category id, and call it like so


// MODIFIES THE CONTENT OF THE PAGE
function st_add_widget($content) {
if (post_is_in_descendant_category('10')) {

if ((is_page() && get_option('st_add_to_page') != 'no') || (!is_page() && get_option('st_add_to_content') != 'no')) {
if (!is_feed()) {
return $content.'<p>'.st_makeEntries().'</p>';
}
}
}
return $content;
}

the code for post_is_in_descendant_category is here

if ( ! function_exists( 'post_is_in_descendant_category' ) ) {
function post_is_in_descendant_category( $cats, $_post = null ) {
foreach ( (array) $cats as $cat ) {
// get_term_children() accepts integer ID only
$descendants = get_term_children( (int) $cat, 'category' );
if ( $descendants && in_category( $descendants, $_post ) )
return true;
}
return false;
}
}


Up 0 Rated Down
Matthew Milan Aug 30, 2013 12:59PM PDT
post_is_in_descendant_category shold go in your functions.php file.

also, the plugin may deactivate itself if you add code to sharethis.php
make sure it's re-enabled to see if the code works

category('10') for me is the only category i wanted showing sharethis. i think you can use a number or even a name in there...
Up 0 Rated Down
Matthew Milan Aug 30, 2013 12:59PM PDT
finally, this is not a perfect solution, as i'm finding a few sharethis widgets in places i didnt expect. i imagine adding more conditionals to the st_add_widget call would fix this
Up 0 Rated Down
ShareThis Support Sep 03, 2013 04:01AM PDT ShareThis Agent
Hello Matthew,

Thanks for the solution.
Our dev team is working on this it will be available in the future versions of Plugin. But right now there is no ETA for this.

Regards,
The ShareThis Support Team,
support@sharethis.com

Add a response

You need to login to post an answer. Click here to login

Customer service software powered by Desk.com