Mar 17, 2013
Tip and Trick Editorial

How to Disable Digg Digg WordPress Plugin when WPtouch Mobile Theme is Active

Digg Digg is a popular all-in-one social sharing buttons plugin for WordPress that is famed for its floating share bar. While WPtouch is another popular WordPress plugin that makes the website mobile-ready.

However, when using Digg Digg and WPtouch together, the floating share bar that normally appears to the left or right side of the blog does not always appear to be a good idea as it simply does not work well. Most of the time, the floating share bar is hidden out of view as the resolution of mobile devices is usually much lesser than typical desktop or notebook computers.

As such, if you’re a webmaster or a blogger, you may want to disable the usage of Digg Digg when the WPtouch mobile interface is been served to visitor. Unfortunately, only the paid version of WPtouch, WPtouch Pro, which does not come free, has the feature to disable plugins which you don’t want it to be enabled together with WPtouch.

Here’s the trick to disable Digg Digg plugin whenever WPtouch is active and WPtouch-enabled mobile version of the website is shown:

  1. Edit the digg-digg.php file which is located in /wp-content/plugins/digg-digg/ directory.
  2. In the file, look for the following function, which starts at about line 41:

    function dd_hook_wp_content

  3. Add in the following lines of PHP code to the beginning of the function:

    if (function_exists('bnc_wptouch_is_mobile') && bnc_wptouch_is_mobile()) {
    return $content;
    }

    The code checks if WPtouch view is active or not, and if it’s active, will return the content immediately instead of proceeding to add in the vertical or horizontal share bar into the content.

  4. Clear the cache if necessary, and the Digg Digg will no longer work when WPtouch mobile view is active.
If you’re updating the Digg Digg plugin in future, you will need to perform the modification of code again. If you intend to write a plugin that can disable a plugin, you can refer to this guide.

After modification, the beginning part of the dd_hook_wp_content function should look like this:

function dd_hook_wp_content($content = ''){

if(function_exists('bnc_wptouch_is_mobile') && bnc_wptouch_is_mobile()){
return $content;
}

if(dd_isThisPageExcluded($content)==true){
return $content;
}

disable-digg-digg-wptouch

Note that the sequence of the checks does not important so it doesn’t matter whether you put WPtouch mobile view check before or after other checks, as long as it stays at almost the top.
  • dedydahlan

    Hi. Great article. However, I have the same problem, only with different plugins. Instead of Diggdigg, I’m using Po.st . And it keep appearing in my Wp- touch and covers a lot of text. How can I turn Po.st off if my wp- touch is active?

    Thanks!

Get latest updates via email: