Skip to content

Instantly share code, notes, and snippets.

@mintplugins
Last active April 30, 2019 17:02

Revisions

  1. mintplugins revised this gist Apr 30, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WordPress javascript required
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ function my_prefix_hide_everything_if_javascript_disabled() {
    ?>
    <noscript id="javascript_test">
    <style type="text/css">
    body > * {display:none;}
    body > * {display:none!important;}
    #javascript_test{
    display:block!important;
    }
  2. mintplugins created this gist Apr 30, 2019.
    16 changes: 16 additions & 0 deletions WordPress javascript required
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    function my_prefix_hide_everything_if_javascript_disabled() {
    ?>
    <noscript id="javascript_test">
    <style type="text/css">
    body > * {display:none;}
    #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' );