Does wordpress need a special folder or area to put in images that need to be in a custom theme? Doing this as is usual is not working for me:
<img src="C:\laragon\www\name\wp-content\themes\themeName\Logo.jpg" alt="Logo">
The image shows up if I use a image from a web site like:
But even when trying to use an absolute path locally it does not show up! Such as:
I am trying to hard code the image into the header.php file.
Is there some nuance to wordpress I am not getting? I am trying this theme from scratch.
Well first of all you should never be using file system paths like C:\blahblah when coding up HTML. You should always use a website url… even if that URL is like http://localhost/Logo.jpg. The reason for this is because almost always when you put this site out on a web server the file system paths are going to be different. You may use C:\laragon, but you put that on a Linux host and suddenly you find your site in the /var/www directory and all your paths won’t work.
But having said that, have you tried escaping all your backslashes?
Again, I would never be using file system path names. For my own load development, I setup something like WAMP or install Apache and run my own web server. If you want to do really really basic editing with PHP, you could even use PHP built in web dev server for development.
By avoiding using file system paths you are going to save yourself a TON of headaches. Trust me.
Ok, thanks for the information. I tried escaping my backslashes and that still did not help. Usually /images/logo.jpg or at least logo.jpg in the same folder as the code works for me. Thats why I tried an absolute path.
Laragon is similar to WAMP if I am not mistaken.
One tip don’t use same name and so path are going to be different
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.