How Can I Exclude Digg Digg on Certain Pages?

Digg Digg

Many of you are familiar with the popular social media plugin Digg Digg for WordPress, created by the great folks over at bufferapp.com. It has been download over 775,672 times and is used by many popular blogs, including ours. The question we get asked a lot by our clients and friends is how to exclude Digg Digg on certain pages? The funny thing is that this is clearly explained on the FAQ page of the plugin, but typical users don’t take advantage of this. So we will walk through them below.

WordPress Text EditorHTML Snippet to Exclude Digg Digg on Certain Pages

There is a small HTML snippet you can paste into any page which will remove Digg Digg from appearing. Make sure you are in HTML (Text) editor mode when you paste this.

We used this small snippet all the time on WordPress sites.

<!-- Digg Digg Disabled -->

PHP Function to Exclude Digg Digg on Certain Pages

There is a small PHP function you can use to exclude pages based upon their page ID. This must be placed in your theme’s functions.php file. This example below is excluding page ID 1. You can exclude more by adding more page IDs. (1,2,3,4 etc.)

function dd_exclude_from_pages() {
if(is_page(1)) {
      remove_filter('the_excerpt', 'dd_hook_wp_content');
        remove_filter('the_content', 'dd_hook_wp_content');
    }
}
add_action('template_redirect', 'dd_exclude_from_pages');

See more on the FAQ page here: http://wordpress.org/plugins/digg-digg/faq/

Hopefully that helps! As always feel free to leave your comments below.

Get More Stuff Like This

Marketing, WordPress, Blogging Tips, SEO and Reviews, once a week.

Thank you for subscribing.

Something went wrong.

Leave a Comment