Created
June 15, 2015 15:17
-
-
Save smutek/4f050a81260c4b32e9cc to your computer and use it in GitHub Desktop.
lists handles for all enqueued styles and scripts
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
/* | |
* Lists out the handles for all enqueued styles and scripts. | |
* Credit: http://wordpress.stackexchange.com/questions/54064/how-do-i-get-the-handle-for-all-enqueued-scripts | |
*/ | |
function wp_inspect_scripts() { | |
global $wp_scripts; | |
echo '<pre><h1>Script Handles</h1><ul>'; | |
foreach( $wp_scripts->queue as $handle ) : | |
echo '<li>' . $handle . '</li>'; | |
endforeach; | |
echo '</ul></pre>'; | |
} | |
add_action( 'wp_print_scripts', 'wp_inspect_scripts' ); | |
function wp_inspect_styles() { | |
global $wp_styles; | |
echo '<pre><h1>Style Handles</h1><ul>'; | |
foreach( $wp_styles->queue as $handle ) : | |
echo '<li>' . $handle . '</li>'; | |
endforeach; | |
echo '</ul></pre>'; | |
} | |
add_action( 'wp_print_styles', 'wp_inspect_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment