WordPress.org

Support

Support » Themes and Templates » [Resolved] Adding images to a theme

[Resolved] Adding images to a theme

  • Susan
    Member

    @shoesie

    Hi,

    I have recently created a new theme called “mytheme”.

    On the sidebar I wish to include an image. I have placed the image in a directory called “images” inside the “mytheme” directoy.

    In sidebar.php I have the <img> src set to “wp-content/themes/mytheme/images/nice_picture.png”

    This image displays fine in the sidebar on the homepage. The problem is on a page with an individual post, the path to the image is no longer correct as we are two directorys deeper.

    How do I make the path to the image more general to work on all pages?

    Thank you,
    Shoesie.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, i had the same problem a while back you want to use the code below:

    <img src="<?php bloginfo('template_directory'); ?>/images/nice_picture.png" border="none" alt="alternative text" />

    Hope this helps

    Susan
    Member

    @shoesie

    Thanks so much. That worked perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Adding images to a theme’ is closed to new replies.