ThemeShaper Forums » Thematic


Image URLs in Child themes

(6 posts)
  • Started 12 years ago by pyemachine
  • Latest reply from pyemachine
  • This topic is resolved
  1. pyemachine

    I am having a great time creating a Child theme to my thematic Wordpress site. I am learning a lot quickly. One thing I can't seem to find out about though is how to do image URLs correctly in my functions.

    Currently I am working on a site locally and when I create a function to add some graphic elements to the sidebar / header / footer I have to do a complete path like so
    I cannot seem to use the wordpress code <?php bloginfo('template_url'); ?>

    This means when I finally go live with the site i will have to change those URLS to the new host.

    Any help on best practices here would be greatly appreciated.


    Posted 12 years ago #
  2. Hi pyemachine,

    I think the issue here is that bloginfo() is going to echo the output and that wont work inside some of Thematic's core functions. Try get_bloginfo() instead and see if that works for you.


    Posted 12 years ago #
  3. pyemachine

    mmm i had a look at bloginfo() and it confirms that the URL for the site is directed to the thematic folder. not sure what i can do to change that outcome. so full paths look like the solution. bummer.

    Posted 12 years ago #
  4. OK I think I get what we're trying to do... try:


    the template url will take you to the parent theme directory while the stylesheet url will take you to the child theme directory

    Posted 12 years ago #
  5. <img src="<?php echo bloginfo('stylesheet_directory')?>/images/file.png"/>

    is what I use to display images that I have stored in my theme's images folder.

    Posted 12 years ago #
  6. pyemachine

    Thanks helgatheviking and em hr. My image URLs are working a treat now with <?php echo bloginfo('stylesheet_directory')?>


    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.