I have created a page with some text in it using this page-about.php as a template; page-about.php contains the basic:

<?php /* Template Name: About us */
get_header(); ?>
        <div id="primary">
            <div id="content" role="main">      

                while ( have_posts() ) : the_post();  the_content(); 

            </div><!-- #content -->
        </div><!-- #primary --> 

<?php get_footer(); ?>

What I don't really understand, if I create another page, let's say Coaching, assign page-coaching.php to it as a template, page-coaching.php having the same content as the one above but with /* Template Name: Coaching */, of course, when I view the page is showing me the content of the Homepage? And also Coaching disappeared from the menu?!

This is driving me crazy, any suggestions please?

I have created custom post types for both, exact copies, just changed about to coaching from one part to another, like this:

// Custom post type => ABOUT US
add_action( 'init', 'create_about' );
function create_about() {
  $labels = array(
    'name' => _x('About us', 'post type general name'),
    'singular_name' => _x('About us', 'post type singular name'),
    'add_new' => _x('Add New', 'About us'),
    'add_new_item' => __('Add New About us'),
    'edit_item' => __('Edit About us'),
    'new_item' => __('New About us'),
    'view_item' => __('View About us'),
    'search_items' => __('Search About us'),
    'not_found' =>  __('No About us found'),
    'not_found_in_trash' => __('No About us found in Trash'),
    'parent_item_colon' => ''

  $supports = array('title', 'editor', 'revisions', 'excerpt', 'thumbnail', 'page-attributes');

  register_post_type( 'about',
      'labels' => $labels,
      'public' => true,
      'has_archive' => true,
      'hierarchical' => true,
      'query_var' => true,
      'supports' => $supports
  • 1
    why do you have a post type for about us? That doesn't make sense...
    – mor7ifer
    Feb 27, 2012 at 16:29
  • As it will have several pages underneath which are going to be listed as a menu on the left side while in the About section, and I have chosen to use post types so I will have them nicely separated on the left side rather than having to simply create pages and assign then to a category. Feb 27, 2012 at 16:40
  • 1
    What about just using pages and subpages? Your code is ALL whacked up for what you're trying to do...so I'm trying to figure out what the best advice to give you is before I give it.
    – mor7ifer
    Feb 27, 2012 at 16:42
  • Cristian that way of doing things is confusing and does not scale beyond a handful of pages. It also removes any sense of heirarchy and adds new problems for you to fix. If you need a sidemenu, just use a menu widget and sub pages
    – Tom J Nowell
    Feb 27, 2012 at 16:46
  • It appears that WordPress is doing exactly what you're telling it to do. Do you want to use static Pages, or do you want to use custom posts? You really can't mix-and-match the two. Feb 27, 2012 at 16:51

1 Answer 1


You created a specific page template for a page called 'about' but your page is called 'About Us'. Try creating a page named 'About' or renaming your file to page-about-us.php.

Also use the cleaner formatting involving new lines:

Template Name: Example Page

You're also not checking if there is a post and executing the loop regardless

if( have_posts()){
    // put the while loop here

I have no idea why you have involved custom post types for this. You're working with a page template, and you assign page templates to pages. Those custom post type definitions may even be interfering with the working of your pages if they have the same post type name as your pages slug.

  • Renaming the page doesn't change a thing, as it can have any name as long as the chosen template is pointing to that page, am I wrong? I've done it anyway and this didn't change a thing. I have also reformatted the Template Name at the top without any changes. Feb 27, 2012 at 17:00
  • Remove the custom post type code. Also page templates only work for pages. You cannot use a page template on a custom post type, you will need to use a different kind of template for that
    – Tom J Nowell
    Feb 27, 2012 at 17:06
  • Even if you refuse to remove the insanity that is the custom post type idea, at the very least, prefix the post types name with a common prefix
    – Tom J Nowell
    Feb 27, 2012 at 17:07
  • Hang on a second, the pages are created from Pages, not from the Custom post type menu. Like anyone would create a normal page, assign a template for it. And removing entirely the custom post types functions/code doesn't help either. Feb 27, 2012 at 17:22
  • 1
    Note, if you have a custom page template named page-about.php, and a static Page named "About", then WordPress will automagically use that page-about.php template file to render the "About" page. Refer to the Template Hierarchy. Feb 27, 2012 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.