Reputation: 4898
I've created a twentyfourteen child theme using the One-click child theme plugin. Then I copied the page.php template from the parent theme folder to the file new-template.php in the child folder. I changed the header in new-template.php to
Template Name: New Template
As far as I know that's all I need to do to get "New Template" to show up in the Template dropdown under Page Attributes when you create a new page. But "New Template" hasn't been added to the dropdown. Does anyone know what the problem might be?
Thank for any help
Upvotes: 6
Views: 10445
Reputation: 17
I know this post is old but this could help someone.
You might have removed the style.css file, it is located in the root of your theme (wp-content/themes/your-theme-name/style.css).
A way of knowing if this is your problem is going inside "Apparence>Themes" and looking for this error: "Error: Stylesheet is missing".
If you do have the error you can copy this and put it inside your style.css
/*
Theme Name: your-theme
Theme URI: https://wordpress.org/themes/twentytwelve/
Author: the WordPress team
Author URI: https://wordpress.org/
Description: The 2012 theme for WordPress is a fully responsive theme that looks great on any device. Features include a front page template with its own widgets, an optional display font, styling for post formats on both index and single views, and an optional no-sidebar page template. Make it yours with a custom menu, header image, and background.
Version: 1.0
Requires at least: 3.5
Requires PHP: 5.2.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, one-column, two-columns, right-sidebar, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, footer-widgets, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready
Text Domain: twentytwelve
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
/* =Notes
--------------------------------------------------------------
This stylesheet uses rem values with a pixel fallback. The rem
values (and line heights) are calculated using two variables:
$rembase: 14;
$line-height: 24;
---------- Examples
* Use a pixel value with a rem fallback for font-size, padding, margins, etc.
padding: 5px 0;
padding: 0.357142857rem 0; (5 / $rembase)
* Set a font-size and then set a line-height based on the font-size
font-size: 16px
font-size: 1.142857143rem; (16 / $rembase)
line-height: 1.5; ($line-height / 16)
---------- Vertical spacing
Vertical spacing between most elements should use 24px or 48px
to maintain vertical rhythm:
.my-new-div {
margin: 24px 0;
margin: 1.714285714rem 0; ( 24 / $rembase )
}
---------- Further reading
http://snook.ca/archives/html_and_css/font-size-with-rem
http://blog.typekit.com/2011/11/09/type-study-sizing-the-legible-letter/
/* =Reset
-------------------------------------------------------------- */
Upvotes: 0
Reputation: 1450
1.active your child theme
2.if you optimze your style.css file add again your first comment such as
/*
Theme Name:
Description:
Author:
Theme URI:
Author URI:
Version:
Template:
License:
License URI:
Text Domain:
Tags:
*/
Upvotes: 0
Reputation:
I tried everything and finally did as stol mentioned above. Update the verison of your theme is style.css located in your themes folder. Mine was set to 0.1.3. I updated to 1.1.2 and it worked.
Upvotes: 0
Reputation: 917
For the Wordpress 4.9 bug mentioned above, just update the version of your theme in style.css, e.g. from 1.1.2 to 1.1.3 - even 1.1.2-1 will do. This will force updating templates list.
Upvotes: 6
Reputation: 8941
Just in Wordpress 4.9 there's this bug: https://core.trac.wordpress.org/ticket/42573 causing the template files to only be rescanned once every hour.
To fix (until they release a new WP version with this changed), download the patch on that bug ticket and make the changes from the patch to wp-includes/class-wp-theme.php
.
Hope this saves someone the 2 hours I wasted on this..
Upvotes: 10
Reputation: 53
This worked for me :
<?php /* Template Name: Red Template */ ?>
and a copy of page.php in my theme dir called redpage.php
I also had to log out of the admin and then log back in.
Upvotes: 1
Reputation: 4137
Please make sure You have activated your child theme, if your child theme is already activated then try a different template name.
Upvotes: 1