WordPress.org

Ready to get started?Download WordPress

Forums

Create absolute url for image (5 posts)

  1. karengraham
    Member
    Posted 5 years ago #

    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

  2. stvwlf
    Member
    Posted 5 years ago #

    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.

  3. eebanks
    Member
    Posted 4 years ago #

    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

  4. 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

  5. eebanks
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic