Image Path not working if not hardcoded
-
I have a theme under devopment in MAMP and would like to return a simple image without having to hardcode the full path to it each time I use it, also because updating this path when the theme is online is just not the desired way.
my code:
<a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url('/')); ?>" title="Brand"> <img style="max-width:30px; margin-top: -7px;" src="https://localhost:8888/wordpress/wp-content/themes/minimax3/functions/Smile-success.png"> </a>
That works.
Now if I use:
1. ../Smile-success.png (or whatever) the image is broken
2. If I use get_template_directory_uri() the image is broken
3. If I use img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/image.jpg” alt=”whatever”/>. is also brokenIs it really possible that there is no possibility to return the image without hardcoding the entire URL?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Image Path not working if not hardcoded’ is closed to new replies.