I was writing some functions that are used in the admin for my commercial WordPress theme: Lucidity and stumbled upon a great variable in WordPress: $pagenow. This variable will return the current page you are on and is great form admin functions – especially those that you want to only make available on certain pages.
To use this – just add it to your functions as a global variable, then you can use it to load in specific js/functions:
global $pagenow; if (($pagenow == 'admin.php') && ($_GET['page'] == 'sdac_appearance')) {}
This proved to be very helpful when dealing with some finicky JS.
Jeff
Thanks for sharing this function. I was working on a plugin the other day and this will come in handy when I get back to it!
Reading back through your site now to see what other info I’ve missed.
scott bothel
Ugh! What a life saver you are this morning. My admin scripts were screwing up the media upload on post edits. Now they are isolated to the theme settings screen.
Thanks!
Jan
You really saved my life, as WordPress 3.3 crashed my theme today and added my theme settings in post-new.php where they shouldn’t be.