VidYen / VidYen-WordPress-Plugins

VidYen Plugins for WordPress
GNU General Public License v2.0
9 stars 2 forks source link

Hard coded graphics issue. #140

Closed VidYen closed 5 years ago

VidYen commented 5 years ago

Mika pointed out this issue in VidHash

Hardcoded plugin folder name

Your plugin won't work via our directory because you hardcoded in the plugin's folder. You've defined your plugin name like this:

plugins_url( '../vidyen-vidhash/images/vyworker_001.gif', __FILE__ )

Please read http://codex.wordpress.org/Function_Reference/plugins_url - you'll notice how we have a FILE parameter used in most examples. If you change your plugin to use that, it will work no matter what the folder name is.

I should get around to fixing the VYPS. I do not remember why i had the ../(pluginname)

VidYen commented 5 years ago

https://codex.wordpress.org/Function_Reference/plugins_url

<?php
echo '<img src="' . plugins_url( 'images/wordpress.png', __FILE__ ) . '" > ';
?>
The above might ouput this HTML markup: <img src="http://www.example.com/wp-content/plugins/my-plugin/images/wordpress.png">.

If you are using the plugins_url() function in a file that is nested inside a subdirectory of your plugin directory, you should use PHP's dirname() function:

<?php
echo '<img src="' . plugins_url( 'images/wordpress.png', dirname(__FILE__) ) . '" > ';
?>
The above might ouput this HTML markup: <img src="http://www.example.com/wp-content/plugins/images/wordpress.png">.
VidYen commented 5 years ago

I'm 60% sure this was fixe as when i looked at it it was.