• Resolved labecs

    (@labecs)


    I’m hoping someone can help because I’m stuck… it’s a little bit of a code problem.
    I put a text widget on my side bar, and I put a picture there, but I don’t know what I did in the code that it only shows on the home page sidebar but not on the rest of the posts. Then I tried to put another widget with a picture in another sidebar, but I can’t get it to work. Can someone give me a hand? I’m just learning how to use code, and this is going over my head…

    http://www.yourpetsuniverse.com

Viewing 3 replies - 1 through 3 (of 3 total)
  • The image link breaks because you used a relative path to code the image link. Because you use pretty permalinks, your relative files get all messed up.

    So.

    To fix it, you need to use code like this:

    Assuming you have an image entitled cat.png and it is located in the images folder in your theme:

    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/cat.png" alt="" title="" />

    This is the bit of code that instructs WP to make sure to load the image from the images directory in your theme:

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

    Hopefully that answers your question.

    Also, if you want to load images from a folder in your main domain directory – like domain.com/images – then you would need to use a variation of that php code I showed you:

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

    So in your case, if you want to load images from your main domain’s image folder, here is a working example using one of your own images:

    <img src="<?php bloginfo('url'); ?>/images/items/condo%20image.jpg" alt="" title="" />

    Thread Starter labecs

    (@labecs)

    Thank you… solved it…. I was missing a slash…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Putting a picture on a widget .’ is closed to new replies.