I've got some problems with templates in Wordpress (multisite). I've created a file in the root of my child-theme folder (template-test.php)
<?php
/**
* Template Name: Test template
*
*/
?>
<?php get_header(); ?>
<?php get_footer(); ?>
This template is not showing up in the templates dropdown when creating a new page, or editing an existing page. The only thing in the dropdown is the 'default template'.
What I've tried so far: - Disabling and enabling my theme - Flush permalinks - Check permissions of my files - Check if style.css is in the root of the template folder (it is)
I've tried the same file on another Wordpress installation, and there it works fine.
I've got some problems with templates in Wordpress (multisite). I've created a file in the root of my child-theme folder (template-test.php)
<?php
/**
* Template Name: Test template
*
*/
?>
<?php get_header(); ?>
<?php get_footer(); ?>
This template is not showing up in the templates dropdown when creating a new page, or editing an existing page. The only thing in the dropdown is the 'default template'.
What I've tried so far: - Disabling and enabling my theme - Flush permalinks - Check permissions of my files - Check if style.css is in the root of the template folder (it is)
I've tried the same file on another Wordpress installation, and there it works fine.
Just in Wordpress 4.9 there's this bug: https://core.trac.wordpress/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..
Make sure you have index.php in your main theme. Main theme must have index.php. I have same issue, and this was the case. Checked by:
function testate(){
global $wp_themes;
$tema = wp_get_theme();
echo '<pre>';
print_r($tema);
die;
}
add_action('init', 'testate' );
There's a bug in Wordpress 4.9.
I found this temporary plugin super straightforward. I plan on uninstalling it once they fix the bug, but it works great in the meantime!
Plugin: https://github/connorlacombe/WP-Clear-File-Cache
Templates can be deactivated by unsetting them from the wp_themes
global variable before the template dropdown is loaded.
Run this code on the page to see what templates show up:
global $wp_themes;
$tema = wp_get_themes();
print_r($tema["child-theme folder name"]["Template Files"]);
If your template does not show up, the parent theme might have unset it from the array.
It might show up, if you run this code in front-end, as the parent theme might only unset it during the load of the admin editor page.
Download the parent theme and search the files for $wp_themes
and wp_get_themes();
to find the location of that code.
Hopefully they've given you a way to prevent it using a filter, if not you might have to re-add the files in the child theme. This could be helpful: http://www.wpexplorer/wordpress-page-templates-plugin/
I also had this problem with a site on WordPress Multisite and was able to fix it by following these steps:
If this doesn't do the trick for you I'd suggest checking out http://vanseodesign/wordpress/wp-page-templates-dropdown/. There are some other possible solutions in there.
Good luck.
Have you accidentally moved or removed the style.css file from the theme root?
If so, it could be this - recreate the themes style.css to re-enable the template dropdown.
Fix page template not showing in dropdown menu please activate below plugin to fix (instead of changing wordpress core files)
Below is link for download https://drive.google/file/d/1ycHQGdc_vQtvtfBaznJp1KRsEbcoRwxB/view?usp=sharing