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 Page and Post Templates in WordPress Static Page Template Files

"Test" text not appearing in correct location

I'm working through the WordPress Template Hierarchy course, and I'm having a problem on the Static Page Template section.

Zac Gordon enters test language into the page.php file and it appears on the About Us page. When I enter something, it only appears on the Services page. The About Us page displays a message saying "NEW CUSTOM ABOUT PAGE". I have no idea where this text is coming from. I cannot locate it in any of the files.

Here's the markup for the page.php file>

<?php get_header(); ?>

    <div class="container" role="main">

        <div class="row">
            <div class="col-md-8">
TEST!!!!
                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

                    <div class="page-header">   
                        <h1><?php the_title(); ?></h1>
                    </div>


                    <?php the_content(); ?>

                <?php endwhile; endif; ?>

            </div>

            <?php get_sidebar(); ?>

        </div>

    </div>

<?php get_footer(); ?>

If I'm not mistaken, shouldn't the About Us page and Services page both default to the page.php template?

Zachary Green
Zachary Green
16,359 Points

Did you include page.php in the about page?

Hi, Zachary,

I'm not exactly sure what you mean. It's my understanding that any page (in this case, my About Us page) other than the front page and the blog page, should default automatically to the page.php template. I haven't touched any of the core code since downloading the files. Only to add this test language per the video's instructions.

1 Answer

[SOLVED]

Maybe I missed something, but it seems to me that the video states that by altering page.php. your changes will appear in the About Us section of the site. However, I found that this was not the case for me. My Services section defaults back to the page.php, whereas my other sections default to the page template with the appropriate corresponding slug. In this case, page-about-us.php