[wp-hackers] Proposal: standardize plugin-data path

Mike Walsh mike_walsh at mindspring.com
Sat Sep 27 15:51:02 GMT 2008


Thank for the pointer, admin_init() worked perfectly.

I have used phpHtmlLib (http://phphtmllib.newsblob.com) for a number of
years for form processing and some of the other widgets.  The phpHtmlLib
library has a nice feature where you construct a page by building up a page
as an object and then render it once it is built.  I like this approach
because things like CSS and Javascript references can be determined very
late in the logic and added to the object and are then rendered in the
proper order.

Mike

PS:  If anyone is interested, I have a version of the 2.x thread of
phpHtmlLib which loads into WordPress as a plugin so the form processor and
other widgets can be used within WordPress.

-----Original Message-----


Message: 4
Date: Fri, 26 Sep 2008 11:58:31 -0500
From: Otto <otto at ottodestruct.com>
Subject: Re: [wp-hackers] Proposal: standardize plugin-data path
To: wp-hackers at lists.automattic.com
Message-ID:
	<161617690809260958pfe2adf1xef0ce81555df1b5f at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Sep 26, 2008 at 10:24 AM, Mike Walsh <mike_walsh at mindspring.com>
wrote:
> This was very timely as I am working on loading some plugin specific
> Javascript today.  However, I cannot for the life of me figure out why
this
> doesn't work:
>
> function swimteam_admin_head()
> {
>    //  Load CSS
>    swimteam_head_css() ;
>
>    //  Load plugin Javascript
>    wp_enqueue_script('portlet',
>        plugins_url(plugin_basename(dirname(__FILE__)
>        . '/js/portlet.js')), array('jquery', 'interface')) ;
>    var_dump(plugins_url(plugin_basename(dirname(__FILE__)
>        . '/js/portlet.js'))) ;
> }

If you're hooking that to the admin_head action hook, then that's too
late. admin_print_styles and admin_print_scripts happen before
admin_head, so the enqueue is too late to do anything.

Hook to admin_init instead.






More information about the wp-hackers mailing list