How to show Custom Page Template in WordPress Dropdown?
Recently I was working with a theme for one of our client’s WordPress website development. I needed to create custom page templates to meet the requirements.
Therefore I created a couple of custom page templates. But I got frustrated when I was trying to link those templates to some pages within the WordPress website. And I couldn’t find the templates in the template dropdown within the WordPress page editor.
With all my experience I tried a couple of things and one of them worked. Hence the custom page templates which I created started showing in the dropdown.
Here is what I tried.
WordPress custom page template problem
WordPress themes usually come with ready templates. These templates can be linked to WordPress pages from the dropdown towards the right in the WordPress page editor.
These are times when you cannot find the custom page templates you have created in the dropdown.
Now, the answer to the problem!
First option you can try is reset your theme.
This means you can switch to another theme for a minute and then switch back to your own theme. This resets your theme and it may work. It is just like when you reboot your computer after you install an app or a software.
But I wasn’t that lucky and unfortunately it didn’t work for me.
I couldn’t find much help online so I decided to recheck my custom page template and compared it with other custom templates which were showing in the drop down.
Everything looked alright.
I couldn’t find a single error in the PHP code of the custom page templates I created.
After going through the templates again and again I realised that the only thing which was missing in my custom page templates was the small piece of PHP comment which is always there at the top of any page template in WordPress.
/*
Template Name: Custom Page Template Name
*/
This PHP comment is used by WordPress to identify the page templates. It sounded strange but it is true that if your custom page template is missing this small comment then WordPress will not read your template.
Summary
If you are facing the problem of your Custom Page Template not showing in your WordPress dropdown. Then you need to make sure that your template in WordPress has a proper comment which shows the name of the template.
Or you can contact a professional WordPress website development company to fix this or any other issues seamlessly for you.
Want to fix WordPress issues or Need a WordPress Website? Contact us now for any WordPress requisite.