- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’ve tried without success to hard code images in WordPress pages. The last thing I want to do is use a complete url to the image, I’d rather have it point if possible to my current theme. I’m doing this in the backend of WordPress by writing and editing a page.
So for example, I have this image that I want to hard code:
<img src="/images/everybody_dancing_home.jpg" alt="weddings" />
i’ve tried adding some php to the image tag:
<img src="<?php bloginfo(‘template_url’); ?>/images/everybody_dancing_home.jpg" alt="weddings" />
However, when I look at my source code I see this:
<img src="<?php bloginfo(‘template_url’); ?>/images/everybody_dancing_home.jpg” alt=”weddings” />
So it looks like the character code is messed up, but when I look in my WordPress page everything appears normal. I’ve also written it out by hand a few times just to check.
I can’t point you to a site because I’m doing this on a local web server, but any help would be greatly appreciated!
Thanks
Mike
It sounds like you’re adding the <img> tag in the "Visual" tab. Make sure you are in the "HTML" tab when you add in code like that.
Have you installed the Exec-PHP (http://wordpress.org/extend/plugins/exec-php/) Plug-in? I don’t believe you can use PHP in your posts or pages without it installed. I know that it has allowed me to do exactly what you’re wanting to do when I’m linking to items in my posts and pages.
Hope this helps you!
Thanks for the tip on the plug-in!
Doing exactly as I need now.
Mike
Ah yes! Silly me, of course that would cause problems!
Glad you got it sorted.