Last active
April 30, 2019 17:02
-
-
Save mintplugins/e5dcb6883094b4bda3d2e4c20494c579 to your computer and use it in GitHub Desktop.
If javascript is disabled, hide everything on the page and show a message.
This file contains hidden or 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
function my_prefix_hide_everything_if_javascript_disabled() { | |
?> | |
<noscript id="javascript_test"> | |
<style type="text/css"> | |
body > * {display:none!important;} | |
#javascript_test{ | |
display:block!important; | |
} | |
</style> | |
<div class="noscriptmsg"> | |
<?php echo __( 'You don\'t have javascript enabled. Check your browser extensions to see if any might be disabling it.', 'text_domain_here' ); ?> | |
</div> | |
</noscript> | |
<?php | |
} | |
add_action( 'wp_footer', 'my_prefix_hide_everything_if_javascript_disabled' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment