WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Creating dynamic image links... (2 posts)

  1. killertofu01
    Member
    Posted 5 years ago #

    Thanks for all the help in advance...

    I am trying to create templates in a test directory. In this template, I am trying to insert images into template pages, but they are listed in a directory in my WP root directory. For example, in my footer.php page, I am inserting an image located in my WP root directory: (.com/wp).

    My question is, is there a markup that I can use so that when I merge the new theme to a different WP installation, I don't have to go back and change all the image links?

    Right now, all image links look like this:
    <img src="testsite.com/wp/images/image.jpg">
    But when I go and add the template to the live site, I end up having to change all the image links to:
    <img src="livesite.com/wp/images/image.jpg">

    I want to know if there is a way I can add something like the bloginfo tags so that all I have to do in my test site template is something like:
    <img src="<?php bloginfo('wpurl'); ?>/images/image.jpg">
    So that no matter where I put the template, it will always look to the WP directory for the images.

    Thanks!

  2. killertofu01
    Member
    Posted 5 years ago #

    Nevermind, figured it out for myself...

    Anyone wondering the same thing:

    <img src="<?php bloginfo('url');?>/wp/images/image.jpg">

Topic Closed

This topic has been closed to new replies.

About this Topic