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 trialzaminasunderji3
2,748 PointsSingle portfolio page is using the single.php template. How do I direct it to use the single-portfolio.php template?
<?php get_header(); ?>
<div class="container"> <div class="row">
<div class="col-md-12">
<?php if (have_posts()) : while(have_posts()) : the_post(); ?>
<div class="page-header">
<h1><?php the_title(); ?></h1>
</div>
<?php the_content(); ?>
<?php endwhile; else: ?>
<div class="page-header">
<h1>Sorry!</h1>
</div>
<p>There is no content for this page!</p>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?> </div>
2 Answers
Fábio Tavares da Costa
11,985 PointsHi Mina S. ,
There is a video that addresses the topic--exactly.
Take a look at the-portfolio-single-page video.
Hope it helps, Cheers!
Fábio Tavares da Costa
11,985 PointsOk,
That's on hierarchy
I have vvv installed. That's what I use when I deal with WordPress. But I'm not doing it right now, though I do not have a real example to show you.
Here is TH course only on hierarchy.
http://teamtreehouse.com/library/the-wordpress-template-hierarchy.
Via search I got:
The newest member is
singular.php
, coming in 4.3, which covers whatsingle.php
andpage.php
combined do now.by Chris Coyier
That said, the info here on template hierarchy may be outdated, but with the information in the quote from Coyier in mind, the course above can help you. Adapt it.
http://wphierarchy.com/ # shows the current hierarchy
zaminasunderji3
2,748 Pointszaminasunderji3
2,748 PointsHey Fabio. I set up my templates according to those instructions but for some reason my single portfolio page doesn't recognize single-portfolio.php as the template to use. It keeps defaulting to single.php.