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

Mike Walsh mike_walsh at mindspring.com
Fri Sep 26 15:24:45 GMT 2008


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'))) ;
}

The output of the var_dump() shows up at the top of the rendered page and
the path is correct so I know my function is executing but there isn't a
<script> tag reference to either "interface" (which is a dependency) or my
plugin specific code in the resulting HTML.

Why wouldn't something which was enqueued show up in the output?

Thanks,

Mike


--
Mike Walsh -- mike_walsh at mindspring dot com


On Sep 26, 2008, at 9:49, Frank Bueltge wrote:

> You can use the function:
> plugins_url()
>
> example:
> for images:
> plugins_url('/simple_banner/includes/farbtastic/farbtastic.png')
>
> for JS is this better:
> wp_enqueue_script( 'farbtastic',
> plugins_url('/simple_banner/includes/farbtastic/farbtastic.js'),
> array('jquery'), '1.2' );
>
> for css:
> wp_enqueue_style( 'farbtastic',
> plugins_url('/simple_banner/includes/farbtastic/farbtastic.css'),
> array(), '1.2', 'screen' );
>
> Liebe Gr|sse
> Frank
> ______________________________
> Mein Buch: WordPress - Weblogs einrichten und administrieren | ISBN
> 978-3-937514-33-8
>
> bueltge.de
> kvfl.com




More information about the wp-hackers mailing list