Created
December 27, 2009 06:55
-
-
Save whalesalad/264187 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| This creates a global variable called SG_STATIC with the full absolute URL to the static directory. | |
| Note: this will only work if you're creating the statement inside of the base directory of your plugin | |
| */ | |
| define('SG_STATIC', WP_PLUGIN_URL.'/'.basename(dirname(__FILE__)).'/static'); | |
| // For example: | |
| echo SG_STATIC; | |
| // Will print out http://wordpress_server.com/wp-content/plugins/plugin_folder_name/static | |
| // So in your situation, you could easily do something like | |
| define('MYPLUGINNAME_DIRECTORY', WP_PLUGIN_URL.'/'.basename(dirname(__FILE__))); | |
| // And then in your use you can do the following | |
| echo '<img src="'.MYPLUGINNAME_DIRECTORY.'/runners-log-chart.png" alt="image" />'; | |
| /* | |
| Which will print out: | |
| <img src="http://wordpress_server.com/wp-content/plugins/runner_plugin_folder/runners-log-chart.png" alt="image" /> | |
| */ | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment