Last active
December 13, 2018 17:55
-
-
Save mmh4560/ea1ec7fccc1581f45923bf9d2bc2794d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// [desktoponly] shortcode | |
add_shortcode('desktoponly', 'wp_snippet_desktop_only_shortcode'); | |
function wp_snippet_desktop_only_shortcode($atts, $content = null){ | |
if( !wp_is_mobile() ){ | |
return wpautop( do_shortcode( $content ) ); | |
} else { | |
return null; | |
} | |
} | |
// [mobileonly] shortcode | |
add_shortcode('mobileonly', 'wp_snippet_mobile_only_shortcode'); | |
function wp_snippet_mobile_only_shortcode($atts, $content = null){ | |
if( wp_is_mobile() ){ | |
return wpautop( do_shortcode( $content ) ); | |
} else { | |
return null; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment