Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress The WordPress Template Hierarchy Miscellaneous Templates in WordPress Media Templates

Fabio Chiarato
Fabio Chiarato
9,701 Points

Maybe a little mistake...

Following del template hierarchy it should be image_png.php and not imagepng.php as shown on video.

simonjones4
simonjones4
10,638 Points

Hi Fabio,

I got it working by changing imagepng.php to image-png.php (i.e. separated by a hyphen).

Which is odd, because the template hierarchy chart shows an underscore as the separator as you suggest, not a hyphen. Perhaps the naming rules have been updated and the chart doesn't yet reflect this. Who knows.

Simon

1 Answer

John Ewell
John Ewell
1,730 Points

Also I noticed that if both image.php and image-png.php exist, image-png.php now does take precedence, which Zac in the video says wold be the more intuitive behavior. Also the example file "imagepng.php" never seems to come into play, no matter what other files exist or do not exist, which again is what one would expect, given standard WordPress naming conventions.

So it looks as if WordPress has indeed been updated to make it more intuitive (or less buggy?) here. But shouldn't the TeamTreehouse tutorial be updated to reflect this?