1

Problem

I have a template and I want to add new page to my theme for example about. I rename file to template-about.php. Also added comments into template:

<? /*Template Name: About Us*/?>

However, in admin panel do not showing this page. I've read the Theme Handbook on Page Templates

  • 1
    Do you have short PHP tags enabled? Try e.g. <?php instead of <? – birgire Dec 20 '15 at 16:27
  • 1
    Works when I test it. Do you have PHP short tags enabled? Even if you do, don't use them. Use <?php – s_ha_dum Dec 20 '15 at 16:27
  • 2
    PHP shorttags are really really bad coding practice in my opinion. It is the lazyman coding way. IMHO, php shorttags should never have made it into php. Not all servers have shorttags enables, which if it is the case in your case, php shorttags will throw a fatal error (WSOD) – Pieter Goosen Dec 20 '15 at 16:35
  • I'm not for short tags, Peter, but I'm not against laziness, either. A lazy monkey took a stick one day and hit the banana with it, instead of climbing the tree... – Andrei Gheorghiu Dec 21 '15 at 6:47
  • @AndreiGheorghiu being lazy is not bad if you are cleverly lazy, but using bad methods to be lazy is. A lazy monkey took a pee one day in the kitchen sink because the toilet was too far and he was too lazy to take the walk to the toilet. He came to the conclusion that whenever the kitchen is nearer, he can use the kitchen sink as a tiolet to pee in. ;-) – Pieter Goosen Dec 21 '15 at 8:09
2

Try this instead:

<?php
/**
 * Template name: About Us
 */

WordPress could be finicky about the short tags (<? vs <?php) and comment formatting - shouldn't be, but better safe than sorry. Also, make sure that you have the Screen Option to display Page Attributes turned on and that you're on Add New Page, not Post:

image showing Page Attributes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.