Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved] Hard Code Images in WordPress Pages

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26649
    gustav30
    Member

    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&#8221; alt=&#8221;weddings&#8221; />

    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

    #66163
    TheDoc
    Member

    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.

    #66164
    TXChetG
    Member

    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!

    #66192
    gustav30
    Member

    Thanks for the tip on the plug-in!
    Doing exactly as I need now.
    Mike

    #66202
    TheDoc
    Member

    Ah yes! Silly me, of course that would cause problems!

    Glad you got it sorted.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.