Support » Plugin: Digg Digg » [Plugin: Digg Digg] How to Exclude DIGG DIGG from showing up on certain Pages

  • Resolved jnscollier


    How do I EXCLUDE the damn DIGG DIGG bar from showing up on certain pages?

    Developers, think about this for a second and understand why this feature is so important…

    Say you have a private digital download page that customers reach after check-out.

    Do you really want the DIGG DIGG bar showing up for people to share that page all over the internet?

    Pretty common sense stuff.

    I suggest adding functionality to exclude pages based on their page ID. User enters page ID’s to exclude and the plugin performs an

    if(is_page(123)) {don’t show} else {show}

Viewing 12 replies - 1 through 12 (of 12 total)
  • Oh, by the way, I have tried this:

    if(is_page('page-slug-1') || is_page('page-slug-2')) {
        remove_filter('the_excerpt', 'dd_hook_wp_content');
        remove_filter('the_content', 'dd_hook_wp_content');

    I placed it in my functions.php file and it does not do anything.

    Oh, and I did modify the slug part as well. I didn’t just copy/paste it stupidly.

    I tried inserting the code provided on the FAQs page in my theme’s functions.php file as well, and it does not work. Any other way to exclude pages?

    I’m in the same boat. I have a blog template page and want to remove the buttons/bar from that page (they don’t work right on that page anyway for some reason). I, too, have tried the code with the appropriate slug and it does not work. Any help is greatly appreciated!

    Also, by the way, the floating display is half showing on mobile. I thought it was not supposed to show if the screen was smaller than a certain number of pixels?


    Same issue, need to remove from specific pages. Coupled with broken compact view on pinterest – may have to remove and add manually to theme.

    Lack of a way to exclude from specific pages will force me to create separate page templates and do everything manually. Not ideal…

    BTW, you can do this with an ugly CSS hack, by grabbing the ID of the specific page or post and using display:none. It’s really not ideal to be sure – but if you’re stuck…

    It would look like this in your CSS

    #post-2237 .dd_post_share {
    	display:none !important;

    I want to do this also. I posted this question as well.

    I wish the developers were more responsive about giving feedback.

    Has anyone found another sharer they like instead of digg digg?

    Disclaimer: I am not a plugin developer.

    This is what workes for me and how I understand it: The code above needs to be part of a function. This function needs to be placed in your themes function.php. This function needs to be tied to a wordpress hook.

    In my case, the theme that I use has a theme set-up function. Within this set-up function you add the call to your new function, like so:

    /* Remove digg digg buttons/floating bar from certain pages. */
       add_filter( 'body_class', 'your-theme-name_remove_dd_buttons' );

    The hook I use here is body_class. I am not sure if that is the best one to use. Caution.

    Next, outside the theme setup function, I’ve added the new function definition:

    function your-theme-name_remove_dd_buttons() {
    if(is_page( array( 'page-slug-1', 'page-slug-2', 'page-slug-3' ) ) ) {
        remove_filter('the_excerpt', 'dd_hook_wp_content');
        remove_filter('the_content', 'dd_hook_wp_content');

    I have replaced the OR with an array.

      This is an ugly solution for several reasons:

    • For every page that needs to be excluded you have remember to update the functions.php file
    • The same goes for an occasional slug name change
    • Also, it scores very low on user friendliness
    • And this was just for pages. A user might have a good reason to exclude the buttons from a post as well…

    A more elegant solution might be to have a tick box on the post/page edit page, like e.g. the addthis plugin does. It is way more flexible and keeps us, who know just enough to shoot ourselves in the foot, from messing with a functions.php file.

    Here is the code that worked for me:

    /** Exclude DiggDigg from specific pages */
    function eo_exclude_digg_digg() {
    if(is_page(array(1, 2, 3, 4))) {
          remove_filter('the_excerpt', 'dd_hook_wp_content');
        	remove_filter('the_content', 'dd_hook_wp_content');
    add_action('template_redirect', 'eo_exclude_digg_digg');

    …where 1, 2, 3, 4 are the ids of the pages you want to exclude DiggDigg from.

    More details here: Exclude DiggDigg From Specific Pages

    Thanks Eugen. That works great.

    Just in case it wasn’t clear to some people, Eugen’s code goes in the functions.php file in your theme folder. Make sure you back it up and have FTP access to your blog if you’re not experienced with PHP.

    Plugin Author Andrew Yates


    Thanks Eugen.

    We’ll mention your post in the next update within the FAQ.

    Eugen thank you!!!!!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: Digg Digg] How to Exclude DIGG DIGG from showing up on certain Pages’ is closed to new replies.