I recently downloaded the WP Mobile Detect plugin and integrated it to my theme (the original mobile detect library I include from the theme folder and the matching WP-functions I pasted directly into functions.php
).
Now I have one Social Share Plug-In I only want to appear when the site gets requested by desktop devices. So I tried modifying the core files of that plugin, wrapping the output function inside a condition of WP Mobile Detect, like:
if ( ! wpmd_is_phone() ) { // output my share buttons }
Unfortunately, this will return a Call to undefined function
. How can I fix this?
You either have to include/require the WPMD file that includes the function(s) you are using, or just use the globally defined
$detect
object, like so:// EDIT
The above conditional is the equivalent of your
! wpmd_is_phone()
conditional. However, if you want to restrict this to desktop devices only, you should use the following: