WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Header Logo Image (7 posts)

  1. Chudz
    Member
    Posted 3 years ago #

    Hello,

    I am new to WordPress however I have used alot of other simlar software. I want to add a logo image into the header.php

    Do you I need to put some PHP code into the SRC to get the correct image directory.

    For example if I put

    <img src="images/logo.gif" />

    This will show the image loged in mywebsite.com/images/logo.gif BUT if I am at this location on the mywebsite.com/latest-news/article.html it will show the image located at mywebsite.com/latest-news/images/logo.gif which is the wrong location?

    Am I getting this right or am I just confusing my self.

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    <img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/logo.gif" />
  3. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    I would use get_stylesheet_directory_uri() rather than get_bloginfo():

    <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/logo.gif" />
  4. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    works for me!

  5. Chudz
    Member
    Posted 3 years ago #

    Thanks for the quick response :)

  6. Chudz
    Member
    Posted 3 years ago #

    Just woundering what the difference is between the 2 above solutions, can anyone tell me ?

  7. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Both will work, but get_stylesheet_directory_uri() will probably be more forward-compatible. It also should handle http vs https, which I don't believe get_bloginfo() does.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.