[wp-hackers] Re: Plugin interference
Alexander Beutl
xel at netgra.de
Thu Apr 10 20:34:40 GMT 2008
Uh - cool think I got it now ;-) thanks.
Sometimes it the obvious things hide behind my complex thoughts ;-)
this way should be even better then checking the $_GET['page'] - any
thoughts?
Alex
2008/4/10, Andrew Ozz <admin at laptoptips.ca>:
>
> Alexander Beutl wrote:
>
> > jep sure this is nearly as I did it
> > function my_head() {
> > if( $_GET['page'] = 'mypage' {
> > // doit
> > }
> > }
> >
> > but what I wanted to know is how to use the hooks which are especially
> > designed for not needing this:
> >
> > admin_head-(page_hook) or admin_head-(plugin_page)
> > Runs in the HTML <head> section of the admin panel of a plugin-generated
> > page.
> >
> > and
> >
> > admin_print_scripts-(page_hook) or admin_print_scripts-(plugin_page)
> > Runs to print JavaScript scripts in the HTML head section of a specific
> > plugin-generated admin page.
> >
> >
> > (you will find them here:
> >
> > http://codex.wordpress.org/Plugin_API/Action_Reference#Administrative_Actions
> > )
> >
> > This ones were my prefered way to do that - if I just could figure out,
> > what
> > that stuff to add after the normal hookname is - everything I tried just
> > didn't do anything...
> >
>
> I've always used this:
>
> function myplugin_menu() {
> if ( function_exists('add_management_page') ) {
> $page = add_management_page( 'myplugin', 'myplugin', 9, __FILE__,
> 'myplugin_admin_page' );
> add_action( "admin_print_scripts-$page", 'myplugin_admin_head' );
> }
> }
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list