I’ve created a WordPress template for a page. The template is called koebenhavn.php. It’s located in a subdirectory in my themes directory. The code looks like this:
<?php
/*
Template Name: Koebenhavn
*/
?>
<?php get_header(); ?>
<?php
query_posts('cat=3');
while (have_posts()) : the_post();
the_content();
endwhile;
?>
<?php get_footer(); ?>
When I go to the Admin-panel and choose the page, which I want to use this template on, and I press the blue “Update”-button, it switches back to “Default Template” automatically. I’ve never experienced this before.
I’ve tried adding the template on already existing pages as well as newly created pages.
The reason for this behaviour was caused by the name of the file. I was using the Danish letter, ø, in the filename
københavn.php.There’s probably a way to work around this, but for the easy way out, just write
koebenhavn.phpinstead.