Plugin Directory

Changeset 1414536


Ignore:
Timestamp:
05/11/2016 09:52:09 AM (10 years ago)
Author:
Xanthonius
Message:

Moved JS to footer to eliminate render blocking.

Location:
toggleable-admin-bar/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • toggleable-admin-bar/trunk/readme.txt

    r1373714 r1414536  
    4141= 1.2 =
    4242* Fixed responsive styles + no-js styles.
     43
     44= 1.3 =
     45* Moved JS to footer to eliminate render blocking.
  • toggleable-admin-bar/trunk/toggleable-admin-bar.php

    r1373704 r1414536  
    55        Description: Allows you to toggle the admin bar on the front end. Useful for websites with fixed positioned elements, as the admin bar can get in the way. Now has quick-links.
    66        Author: Michael Smyth
    7         Version: 1.2
     7        Version: 1.3
    88        Author URI: http://www.michaelsmyth.co.uk
    99    */
     
    174174                }
    175175            </style>
     176    <?php
     177        }
     178    }
     179
     180    function toggleable_admin_bar_js() {
     181
     182        if ( is_user_logged_in() && is_admin_bar_showing() ) {
     183    ?>
    176184            <script type="text/javascript">
    177185                jQuery(document).ready(function() {
     
    186194    }
    187195
    188     add_action( 'wp_footer', 'toggleable_admin_bar', 100 );
     196    add_action( 'wp_head', 'toggleable_admin_bar', 100 );
     197    add_action( 'wp_footer', 'toggleable_admin_bar_js', 100 );
    189198    add_action( 'get_header', 'remove_admin_margin' );
    190199?>
Note: See TracChangeset for help on using the changeset viewer.