• Resolved Aaron Happe

    (@aaron-happe)


    Hello.

    I am trying to add a static image into my twentytwelve theme. I am having trouble getting this to work.

    The code I am using is:
    <img src=”<?php bloginfo(‘template_url’); ?>/images/brandingImages_03.png”>

    The image file is within my child theme folder, under a folder called images.

    Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Use get_stylesheet_directory_uri instead.
    <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/brandingImages_03.png">

    bloginfo returns parent’s URI.

    Thread Starter Aaron Happe

    (@aaron-happe)

    Thank you! that worked.

    Thread Starter Aaron Happe

    (@aaron-happe)

    BTW, so are you saying the code I entered first would return the URI for the images directory outside of the theme? Or what? In other words, if I was to use the code I used above, what directory would my image have to be in, in order for it to work?

    Like I said, bloginfo('template_url') will return you your parent’s theme URI. In your case it will be http://<your site>/wp-content/themes/twentytwelve.

    Since you created a child theme and your images are there, you want to get a child theme’s URI. That’s why you should use get_stylesheet_directory_uri.

    Thread Starter Aaron Happe

    (@aaron-happe)

    I get you now. Thanks for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘trying to add a static image’ is closed to new replies.