Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Apologies if this has been answered elsewhere, but I've had some trouble finding the solution via Google.

I've set up a parent theme and a child theme. Inside the parent theme I have a directory named img which contains a number of images I want to use in the child theme too.

The problem is, I can't seem to find the best way to reference an image from the parent theme whilst inside the child theme. Surely there is a particular way to reference the path dynamically?

Whilst in the child theme, using <?php bloginfo('template_directory'); ?>/img/ seems to look for the img folder inside the child theme, but I am looking to reference the img folder inside the parent folder.

Any help on this would be great!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can use <?php get_template_directory_uri(); ?> to reference your parent theme folders.

From the WordPress codex:

In the event a child theme is being used, the parent theme directory URI will be returned...

share|improve this answer
    
Fantastic. So simple. Thank you! –  remi90 Dec 3 '12 at 11:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.