knefie
knefie

Reputation: 95

new template in wordpress is not displayed under page attributes -> template

i want to integrate several layouts into my theme. so far I have solved it via page.php and page-blue.php because I saw it that way in tutorials. unfortunately the other template is not displayed under the page attributes. i don't see the error. even if i choose a different theme the attributes do not appear. what am I doing wrong?

it should look like this

it should look like this

this is how it looks

this is how it looks

this is the page.php

this is the page.php

this is the page-blue.php

this is the page-blue.php

Upvotes: 1

Views: 396

Answers (2)

Aman Prasad Kothari
Aman Prasad Kothari

Reputation: 11

pls Use This code

<?php
/*
* Template Name: page-blue
* Template Post Type: post
*/
get_header();
?>

instead of this

<?php
/*
* Template Name: page-blue
*/
get_header();
?>

Upvotes: 1

Bud Damyanov
Bud Damyanov

Reputation: 31829

Change the name of the template, page is reserved word, also create brand-new file with file name other than page.php, which is also reserved file name. And, for god's sake, name your template files in a way they mean something, self-explanatory.

Example for dummies:

<?php
/*
* Template Name: Some Template
*/

And the file name of the template should be some-template.php inside your theme's folder!

Read more

Upvotes: 2

Related Questions