Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So I am assuming that your "img" directory is in the root of your wordpress theme? So for instance if your theme name is "my custom theme" the path might look something like...</p> <p>public_html/wp-content/themes/my custom theme/img/qs_slogan_down.png</p> <p>If that is indeed the case, then I would just assign the variable to the correct path, and you would do that thusly: <code>'&lt;?php bloginfo('template_directory');?&gt;/img/qs_slogan_down.png'.</code></p> <p>Template directory refers to the your theme folder inside of wp-content. </p> <p>That being said, you are still only storing a string in your variable, which you would want to assign to the src attribute of an image.</p> <p>EDIT:</p> <p>I think I understand your dilemma. You want a usable filepath, and if you are trying to get that in a function that gets triggered after the document load, then you aren't going to receive any information from the server because the information has already been served. </p> <p>So you either need to use AJAX (probably a bit too complicated, but good to learn about), or you can do something like the following:</p> <p>In your .php document, use the bloginfo('template_directory') function to call and store the data you need on the page (as some attribute of some element) during the document load, and then pass it to your function as a parameter, and assign your variable to the corresponding parameter so that you have the explicit file path ready to use.</p> <p>Hope that helps! :-) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload