I just moved a site (by exporting & importing all posts & pages, and copying theme files over), and on the new site the various page and post templates are unavailable for selection on post and page edit screens.
The files did have Windows line endings, which I fixed, but that did not eliminate the problem. Any other things to try?
Sounds like it could be an issue with the database and serialization of the plugin options. I’ve had problems before with plugin settings etc when moving a site using the xml export. The category templates plugin writes a lot of options to the db and they could be corrupted.
As a test try creating a php file and putting it in the themes root directory. Add the basic template header:
See if it’s available to choose from.
If you still have access to the old site / server try doing an mysql dump of the database then create a new blank database and import the dump file.
Also you didn’t mention the server / hosting environment of the new and old locations. That info might help debug the issue.
Also wanted to mention that the Category Templates plugin has issues which may or may not be the cause of the problem.
The plugin uses serialize and unserialize in its update_option() and get_option() calls. WordPress already does the serialization for those functions see: http://andrewnacin.com/2010/04/18/wordpress-serializing-data/
If you look at the first few lines of the plugin:
The add_submenu_page function is using user roles (the 8) which was deprecated in version 2.0.
The syntax should be:
<?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ) ?>
It’s also using
basename(__FILE__)
as the admin menu page slug which is a minor security issue.That line in the code should be:
So my answer is that the problem is most likely the plugin and my suggestion would be to either rewrite it or find another one.
Update:
I decided to rewrite the plugin fixing all the issues since the author isn’t really supporting it anymore. For now it’s on GitHub: https://github.com/c3mdigital/Category-Templates
You mentioned Windows line-endings. Did you move from a Windows host to a Linux host? Since Windows doesn’t care about capitalization and Linux does, is it possible that capitalization of the filenames is messing you up now? Like the template names are capitalized in the settings (and database) but the files are lowercased, and they’re not the same file to Linux so they can’t be found?
I’d try this… delete it then reupload it.
Puzzle. Check permissions on the template files, and be sure wp-content is 755. The files should be Unicode no-BOM on a Linux box. Get rid of any whitespace above the the template file headers. And see if page templates show up in twentyten, to rule out admin.