1

This is strange.

I have a file, page_market.php, that is named "Market Main Page". It WAS being used when I chose that page template, but now it is not working at all. Instead, it looks like I'm using the default template.

Why is this happening?

1

This was driving me nuts, and I finally decided to search for where a page template's value is stored in the database. This gave me my first clue, because I found single-sponsor.php, the name of one of the other template files I'm building.

I was confused as to why this could be the case, and looked at the HTML of the actual dropdown menu WordPress generated:

<select name="page_template" id="page_template">
  <option value="default">Default Template</option>
  <option value="page-custom.php">Custom Page Example</option>
  <option value="single-sponsor.php" selected="selected">Market Main Page</option>
</select>

Pretty clearly choosing single-sponsor.php.

Why would it be doing that?

Because I told it to.

I had copied the code from page-market.php into single-sponsor.php to start developing a new page template.

At the top of single-sponsor.php?

<?php
/*
 Template Name: Market Main Page
*/
?>

Right.

Stupid mistake. But I thought it was worth writing up, in case the same thing happens to someone else.

I changed the name before realizing that I didn't want this file to show up in my template list, so I removed the code.

Foo.

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.