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 trialCraig Jamieson
19,585 Pointsthe_title is not setting page title
I have setup my home.php and my categories.php page title to
<h1><?php the_title(); ?></h1>
but unfortunately it does not display the page it's on, it displays the first post list. Is there something I have missed or can someone please point me in the right direction?
Thanks in advance
3 Answers
Zac Gordon
Treehouse Guest TeacherCan you post your full loop code please!
Craig Jamieson
19,585 Points<?php get_header(); ?>
<div id="content" class="clearfix">
<h1><?php the_title(); ?></h1>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<section class="post-content clearfix">
<h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
</section> <!-- end article section -->
<?php endwhile; ?>
<nav class="wp-prev-next">
<ul class="clearfix">
<li class="prev-link left"><?php next_posts_link(__('« Older Entries')) ?></li>
<li class="next-link right"><?php previous_posts_link(__('Newer Entries »')) ?></li>
</ul>
</nav>
<?php else : ?>
<p>There are no posts or pages here</p>
<?php endif; ?>
</div>
<?php get_footer(); ?>
Zac Gordon
Treehouse Guest TeacherTry wp_title();
Craig Jamieson
19,585 PointsThanks Zac, I have tried that and just did it again, just incase and what it displays is the blog name >> and the title like below. I tried it on the archive too and it does the same thing.
CRAIG JAMIESON ยป BLOG