• How do I remove the share-this links from my blog index page?

    My blog index page is set to show the_excerpt(), instead of the_content().

    The problem is I end up with a page showing hundreds of sharethis links all over the place and it looks really stupid.

    I’d like to set it up so that the links are only on single post or single pages, not the archives. Can’t seem to find directions on this, and there seems to be no setting in the admin for this.

    https://www.ads-software.com/extend/plugins/share-this/

Viewing 15 replies - 16 through 30 (of 34 total)
  • oops was not editing Theme Functions… now working ok thanks! Great stuff.

    No – problem again. I get this error message (my wootheme is called matamorphosis) –

    remove_filter( ‘get_the_excerpt’, ‘st_remove_st_add_link’, 9 ); remove_filter( ‘the_excerpt’, ‘st_add_widget’ );remove_filter( ‘get_the_excerpt’, ‘st_remove_st_add_link’, 9 ); remove_filter( ‘the_excerpt’, ‘st_add_widget’ );
    Warning: Cannot modify header information – headers already sent by (output started at /home/abl/public_html/hertscollegeofhypnosisandnlp.co.uk/wp-content/themes/metamorphosis/includes/theme-functions.php:46) in /home/abl/public_html/hertscollegeofhypnosisandnlp.co.uk/wp-includes/pluggable.php on line 881

    despite the error, its now working thx!

    cmccrone
    nightmare I can’t login at wp-admin now! I think it arose from a silly mistake in editing the wrong file – the stylesheet – instead of the functions.php. Please – cany help on how to fix this? I get teh following error message on attempting to got to https://hertscollegeofhypnosisandnlp.co.uk/wp-admin >>>>>>

    remove_filter( ‘get_the_excerpt’, ‘st_remove_st_add_link’, 9 ); remove_filter( ‘the_excerpt’, ‘st_add_widget’ );
    Warning: Cannot modify header information – headers already sent by (output started at /home/abl/public_html/hertscollegeofhypnosisandnlp.co.uk/wp-content/themes/metamorphosis/includes/theme-functions.php:46) in /home/abl/public_html/hertscollegeofhypnosisandnlp.co.uk/wp-includes/pluggable.php on line 881

    Just get a free FTP program like FileZilla. You can login to your WordPress files and edit it with a simple text editor just like you do when you’re logged in to WordPress.

    Make sense?

    hi cmccrone
    yes – any ideas which file may be at fault and what might i be looking for?

    ps the following text now appears at the top of my site (hertscollegeofhypnosisandnlp.co.uk)when viewed:
    remove_filter( ‘get_the_excerpt’, ‘st_remove_st_add_link’, 9 ); remove_filter( ‘the_excerpt’, ‘st_add_widget’ );

    cmccrone
    Excellent help. Thanks. All sorted after my silly error.

    I don’t know if this is a help to anyone else, but I wanted to just completely remove ShareThis from a special page template. I have ShareThis buttons turned off for pages and a shortcode to add them when I want them, but I do use the hover buttons and wanted to eliminate those from pages as well. Putting this at the top of your template.php file should completely remove the functionality from pages that use that template.

    /* Remove the ShareThis stuff en-masse */
    remove_action('wp_head', 'st_widget_head');

    thank you @cmccrone your code worked perfectly when added to my Functions.php file!

    @cmccrone

    For some reason, my excerpts are still showing up on my category and blog pages under the excerpts. Any idea how to remove them? I added your lines of code to my functions.php

    https://www.travelgrom.com/category/coachella/

    I prefer to put this in the theme functions file.

    function remove_sharethis() {
    	if ( ! is_singular( array( 'post', 'page' ) ) ) {
    		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' );

    It gets rid of this annoying code except on single posts or pages. Feel free to tailor it how you like, the normal WordPress conditionals will work there.

    @cmccrone Your functions.php solution for removing it from excerpts worked great. Thank you!

    Thanks @cmccrone. That did the trick for me as well.

Viewing 15 replies - 16 through 30 (of 34 total)
  • The topic ‘Remove share-this from the_excerpt()?’ is closed to new replies.