• Resolved JessicaRodgers

    (@jessicarodgers)


    I am theming my first wordpress theme and I cannot get my file path for my images to work. my file path is this:
    <img src=”images/logo.png” alt=”ISRL Logo” width=”255″ height=”152″ id=”logo”>

    <img src=”images/name.jpg” alt=”ISRL name” width=”364″ height=”112″ id=”teamName”>

    my images are in my images folder within my theme folder.

    BTW I am doing development locally on WAMP.

    Thanks for you help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Background images set in stylesheets are relative to the stylesheet.
    If your styles are in your theme then the right path is
    “images/mybackground.gif”

    But IMG SRC in documents must have a path relative to the document.
    In the case of wp documents that would be ‘path-to-wp/wp-content/themes/yourthemename/images/yourpic.jpg’ if you really want to keep your images there.

    path-to-wp/ might be nothing if you installed wp in your web root directory, or it might be blog/ if you installed wp in a subdirectory called blog. remove the slash too if path-to-wp/ is nothing.

    It is often more convenient to have your content images in their own directory. So wherever wp is, you can create a directory for your content images in that directory. then src=’images/mypic.jpg’ will be right and it will be right even if you change themes.

    Thread Starter JessicaRodgers

    (@jessicarodgers)

    I found help on this site for my image problem.
    https://css-tricks.com/forums/viewtopic.php?f=10&t=5952

    Using a template path will work such as

    <?php bloginfo('template_directory'); ?>

    so when inserting this in the img src tag it would look like this:

    <img src="<?php bloginfo('template_directory'); ?>/images/night-2.jpg" width="300" height="225" />

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘html img src tag not working for me’ is closed to new replies.