PHP image paths in pages to avoid absolute paths
I’ve been using
<?php bloginfo('stylesheet_directory'); ?>/images/MyImage.pngin my template files, and it’s been working great.
When I go to the WordPress Dashboard > Pages > Add New and try to use it in my pages though, the image doesn’t show up. I tried using the
<?php bloginfo('name'); ?>as well, but that doesn’t work either.
Does anyone know what the problem might be? There surely must be a way to use the
<img>tag in pages and posts without having to use absolute image paths?
I need to add over a thousand images, so by using absolute paths, I risk having to do a lot of work later if I should move around some files, or rename the theme or something like that.
- The topic ‘PHP image paths in pages to avoid absolute paths’ is closed to new replies.