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