Logo and template img path broken after permalink change
-
I’m sure it is common to use relative image paths into your wordpress theme, normally in header.php. I normally put the logo in the images folder of the root directory. the path to the logo is then coded as
<img src="/images/logo.jpg" />
This works until you change your permalinks. Permalinks change the url to reflect a directory stucture in place of the ugly ‘?page_id=1’, thus breaking the path to /images.
The hack:
Where you have used relative image paths, (as intro code), replace it with<img src="<?php echo get_option('siteurl'); ?>/images/logo.jpg" />
This uses your specific siteurl as a prefix to the path of the image.
Hope this helps, it is a great hack
- The topic ‘Logo and template img path broken after permalink change’ is closed to new replies.