[wp-trac] [WordPress Trac] #6341: feature request: plugin_baseurl()
function
WordPress Trac
wp-trac at lists.automattic.com
Fri Mar 21 21:57:05 GMT 2008
#6341: feature request: plugin_baseurl() function
-------------------------------+--------------------------------------------
Reporter: Denis-de-Bernardy | Owner: anonymous
Type: defect | Status: new
Priority: low | Milestone:
Component: Optimization | Version: 2.5
Severity: minor | Keywords:
-------------------------------+--------------------------------------------
{{{
function plugin_url($file) {
$url = plugin_basename($file);
$url = preg_replace("/[^\/]+$/", '', $url); // not dirname(), as it
returns '.' for Dolly
$url = trailingslashit(get_option('siteurl') . 'wp-content/plugins/' .
$url;
return $url;
}
$my_path = plugin_url(__FILE__);
var_dump($my_path); // domain.com/wp-content/plugins/myplugin/
wp_enqueue_script('my-js', $my_path . 'scripts.js');
}}}
it would be handy to include css and js files... thanks.
--
Ticket URL: <http://trac.wordpress.org/ticket/6341>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list