Support » Requests and Feedback » Create absolute url for image

  • karengraham

    (@karengraham)


    Please can you give me some help. I would like to add my own image as a header to my blog. I need to give an absolute url for the image I want to use but I don’t know how to create one. If anyone can also walk me through the steps for the whole procedure I would also really appreciate it. Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • stvwlf

    (@stvwlf)

    Hi

    If you put the image in the images folder your theme folder an absolute image would be:

    http://mydomain.com/wpinstallfolder/wp-content/themes/mytheme/images/imagename.jpg

    shortcuts for the same are
    <?php bloginfo('template_directory'); ?>/images/imagename.jpg
    or /wpinstallfolder/wp-content/themes/mytheme/images

    wpinstallfolder means the folder in which you installed wp if you installed into the root folder leave /wpinstallfolder off of the absolute path.

    Help
    i think you are on to my problem but I am wrapping a logo image within an anchor in the header php file
    after several attempts I now have an image no show but it is clickable to the home page of my web site.
    The full image path is
    http://wheninbangkok.com/public_html/blog/wp-content/themes/greentweet_extend/images/WIBlogoblog.png

    the code (after trying different ways) is

    <a href="http://www.wheninbangkok.com/"><img src="<?php bloginfo ('template_directory'); ?>/public_html/blog/wp-content/themes/greentweet_extend/images/WIBlogoblog.png alt="<?php bloginfo('name'); ?>" />
        </a>

    what am I doing wrong? what can you suggest for a fix? anything please I am stuck. and I don’t know php but am prettty good with html and css.
    thanks

    Try this:

    <a href="http://www.wheninbangkok.com/"><img src="<?php bloginfo ('template_directory'); ?>/images/WIBlogoblog.png" alt="<?php bloginfo('name'); ?>" /></a>

    When you put in the template_directory bit, it should magically pull in http://wheninbangkok.com/public_html/blog/wp-content/themes/greentweet_extend/

    Also you were missing a ” at the end

    Worked!!! thanks so much –worked on it for 3 hours before finally asking for help–you really saved me time!! thanks again!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Create absolute url for image’ is closed to new replies.