plugins_url [ WordPress Function ]
plugins_url ( $path = '', $plugin = '' )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Retrieve the url to the plugins directory or to a specific file within that directory.
You can hardcode the plugin slug in $path or pass FILE as a second argument to get the correct folder name.
Source
<?php
function plugins_url($path = '', $plugin = '') {
$mu_plugin_dir = WPMU_PLUGIN_DIR;
foreach ( array('path', 'plugin', 'mu_plugin_dir') as $var ) {
$$var = str_replace('\\' ,'/', $$var); // sanitize for Win32 installs
$$var = preg_replace('|/+|', '/', $$var);
}
if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
$url = WPMU_PLUGIN_URL;
else
$url = WP_PLUGIN_URL;
if ( 0 === strpos($url, 'http') && is_ssl() )
$url = str_replace( 'http://', 'https://', $url );
if ( !empty($plugin) && is_string($plugin) ) {
$folder = dirname(plugin_basename($plugin));
if ( '.' != $folder )
$url .= '/' . ltrim($folder, '/');
}
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
$url .= '/' . ltrim($path, '/');
return apply_filters('plugins_url', $url, $path, $plugin);
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/plugins url « WordPress Codex
The plugins_url template tag retrieves the url to the plugins directory or to a specific file within that directory. You can hardcode the plugin slug in $path or pass ...
codex.wordpress.org - WordPress Plugin-Path - WP Engineer
Apr 27, 2009 ... With WordPress Version 2.8 the function plugins_url() extends and it can be incorporate in a much cleaner way, no maintenance of the folder ...
wpengineer.com - plugins url - Is it safe to pass directory path to plugins_url ...
Apr 27, 2011 ... 1. share [g+] share [fb] share [tw]. plugins_url() function accepts plugin slug or file path to build URL for. I have following directory structure: ...
wordpress.stackexchange.com - How Not to Build a WordPress Plugin
Sep 20, 2009 ... <img src=”<?php echo plugins_url('logo.png', __FILE__) ?>” /> ... <script rel=”<? php echo plugins_url('wcpdx.js', __FILE__) ?>”></script> ...
www.slideshare.net
Kullanýcý Tartýþmalarý [ wordpress.org ]
- RavanH on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- lcvincent on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- RavanH on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- lcvincent on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- RavanH on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- lcvincent on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- lcvincent on "[Plugin: Easy FancyBox]Youtube links go directly to Youtube"
- Luigino on "[Shortcodes in Own Plugin] - Loading CSS and JS"
- Luigino on "[Shortcodes in Own Plugin] - Loading CSS and JS"
- RavanH on "[Plugin: qTranslate] Strange wp_enqueue_style and plugins_url issue"