Update: As with so many mysteries, the cause turned out to be extremely stupid. I had the file saved in a different theme’s directory. Thanks to @a4jp.com
I’m building a theme using underscores. I’ve created a template file and added a template header at the top.
<?php /** * Template Name: Featured **/ get_header(); ?>
I’m not getting a Template drop down under Page Attributes in the page editor, so I’m not sure if there’s a problem with my formatting or something else.
I did try switching themes. The drop down appears in the other theme, but when I switch back to my custom theme, it’s still missing.
Maybe this will help.
<?php /* Template Name: Featured */ get_header(); ?>
Regular code here…
<?php get_footer(); ?>
If one theme works you could try replacing the files in the broken theme and test which file or files are broken. But first save the old files in a separate folder as a backup. Then you would know which file or files are broken pretty quickly.
If you’re not seeing the dropdown at all you might need to reload your theme. Try switching to another theme and then switching back.
This has happened two times for me. At the first time I changed the encoding of the file (header.php I think) to UTF-8 without BOM and all templates disappeared. Changed it back to regular utf-8.
At the second time I somehow edited/renamed the index.php (/themes/theme_name/index.php). Just had to create an empty index.php and now everything seems to be ok.
I hope this helps someone else.
To change just one page or post so it has no side bar. the settings for the Custom Page Templates does not show on the side bar in some templates but! If you scroll down to the bottom of your page, under all that you have written, it appears at the bottom of that.