• Hey all

    I have a loop which is on page.php to call the content for all single pages. This works fine on all pages such as /about/, /contact/, /links/ etc. These pages are set to “default template” and call the page title and content i.e.

    About us

    This is the about us page

    However I have another section of the site where I will use a different template and have set these pages to use my own custom template file.

    My template file is identical to page.php (for now anyway) yet all the pages using the template file call the POSTS from the loop i.e.

    Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

    …not the Page (as above.)

    Am I missing something which makes my template work differently to the default template?

    The template file when used is also not picking up any of my ‘is_home’ conditions – almost as if WP is assuming the template is the home page.

    Any help much appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The WordPress Template Hierarcy controls what template is used for your pages. Of course if you assign a Page Template when writing the Page that template will be used.

    It’s possible you many need to add the post_type=’page’ in your query to return Pages rather than posts.

    Thread Starter boon_

    (@boon_)

    Okay, thanks. Query posts is the answer.

    What about the second part? When using the page template not page.php it’s recognising the page as home so is putting my “is_home” content in ??

    This is also stopping my NavXT breadcrumb from functioning correctly.

    Make sure you are using the correct Conditional_Tags.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The Loop in page.php and other templates’ is closed to new replies.