css - wordpress plugin development - using images - path not found -
I am writing a plugin for WordPress and I'm having problems with images if I have wp-content / plugins My plugins are in / my-plugin / and there, a folder picture / test.png - how do I reference that image in my code? I do not want to put images in the topic, like other users come to get my plugins, then the image will not work!
Then my structure
myplugin / plugin.php (which contains many files ...) myplugin / pluginstyle.css myplugin / included / page.php myplugin / images / Test.png
I have a style sheet working well, but when I try and background an image for an element and work.
How do I reference the image in my plugin?
Test Output from Page.php
& lt; Div class = "test" & gt; & Lt; P & gt; Hello & lt; / P & gt; & Lt; / Div & gt;
CSS
.test {background: url (../images / test page) repeat-x; }
Where am I going wrong? Is there any way I should use? Thanks for any help!
WordPress' PHP continuous WP_PLUGIN_URL
contains the full URL in your plugins folder Therefore, to get the URL, use WP_PLUGIN_URL. '/myplugin/images/test.png'
. In the stylesheet, image paths are always relative to the stylesheet
.test {background: url (images / test.png); }
should work, as long as it is in an external stylesheet. If it is inline, you should use the full URL.
Comments
Post a Comment