0

I started constructing my first Wordpress plugin but got an issue... I've a folder-file structure like that:

  • PluginFolder/
    • TemplateFolder/
      • img/
    • my files php

How can I use the /img/ folder in my plugin? I tried the URL with but didn't works form me.

I don't know whether it is necessary to use any WordPress-specific function, like the bloginfo('template_url') or so.

Any help would be greatly appreciated!

1
<?php
    echo '<img src="' . plugins_url( 'img/image.png', __FILE__ ) . '" > ';
?>

here is the link how to add images or any other files from plugin folder

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

  • 3
    Please add an explanation to your answer: why could that solve the problem? See How to Answer – fuxia Sep 24 '14 at 16:44
  • Thanks for your answer, but not works in my code :( – Marcos Sep 25 '14 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.