For that, use the plugin_dir_url(). codex.wordpress.org/Function_Refer...
The code would be something like: plugin_dir_url( __FILE__ ) . 'images/foo-picture.jpg';
plugin_dir_url( __FILE__ ) . 'images/foo-picture.jpg';
This means the plug-in can be anywhere on the site, but it will still find the 'images' directory in your plug-in folder.
Note: This is a PHP function, so if you're including it in JavaScript (Vue), allow for that.
Ex. <img :src="<?php echo plugin_dir_url( __FILE__ ) . 'images/foo-picture.jpg'; ?>" />
<img :src="<?php echo plugin_dir_url( __FILE__ ) . 'images/foo-picture.jpg'; ?>" />
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For that, use the plugin_dir_url().
codex.wordpress.org/Function_Refer...
The code would be something like:
plugin_dir_url( __FILE__ ) . 'images/foo-picture.jpg';
This means the plug-in can be anywhere on the site, but it will still find the 'images' directory in your plug-in folder.
Note: This is a PHP function, so if you're including it in JavaScript (Vue), allow for that.
Ex.
<img :src="<?php echo plugin_dir_url( __FILE__ ) . 'images/foo-picture.jpg'; ?>" />