• Hi.

    I already looked through the support forums and various Google searches for the answer to this and I cannot figure out what is going on. Please help!!!! I’m going nuts over this. Here’s what happened with a custom theme:

    I created a new page template and uploaded it to my custom theme. Then, when I went to apply the template, I noticed that there was no “Page Template” box under “Advanced Options” on the Edit Pages page.

    I found a few posts on the forums that suggested that I clear all private data – this didn’t work. It was also suggested that I switch to the default theme and then back to my custom theme… this is where the plot thickens. When I went to switch the theme, WordPress said that my theme was broken. Error Message: “Template is missing.”.

    I dug through the source and found the this error is generated by the get_themes() function which is defined on line 122 of /admin/theme.php. What is strange is that it only seems to be programmed to generate this error when the theme does not possess an index.php file. My theme does contain both index.php and style.css. What’s even a little stranger here is the fact that when I visit /wp-admin/themes.php, WordPress does NOT revert back to the default theme as it should if the theme is truly broken:

    ?php if ( ! validate_current_theme() ) : ?>
      24  <div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>

    Anyway, I have tried switching to the default theme and then back to the custom theme (I did this manually by altering a few fields in the options table), but still no template drop down.

    I have made sure that the template names are exactly the same as the file names (this was suggested in a post I read, though I doubt the validity of this practice), no help.

    <?php
    /*
    Template Name: t-two-column
    */
    ?>
    <?php
    /*
    Template Name: t-aux
    */
    ?>

    I also reinstalled WordPress… no help.

    If anyone knows what is going on here, please help me out. I have never had this happen before – and I’m about ready to through my monitor across the room 🙁

    Thanks!!!!!
    -Mike

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Michael Fields

    (@mfields)

    Found the solution to my problem and I am posting it here just in case anyone else finds themselves in a similar predicament…

    I had 2 comments in my stylesheet.css file:

    /* Main Template
    --------------------------------------------------- */

    and

    /* Auxiliary Template: 404, Success + Error Pages
    --------------------------------------------------- */

    Although there is no error here (as far as css is concerned), WordPress does not like the fact that I used the string “Template” inside of comments. When I removed “Template” from both comments, the theme was no longer “broken”.

    Hope this helps someone.

    This was odd.

    I just changed theme to Hemmed (no Ajax?) and heh no template to apply to pages.

    Not sure the ins/outs/whys/wherefores but I duplicated pages.php as template.php and followed the instructions from Codex “Pages” and HeyPresto, the template choice appeared in Manage Pages.

    Different cause; different fix; same problem.

    Thank you so much, Mfields! I was experiencing this exact issue. Some further testing shows that it isn’t the string “Template” that is causing so much drama. It is the “Template:” (with the colon) that causes WordPress to become a drama mama.

    Thanks so much for posting this! I was going crazy trying to figure out why the theme I’m designing kept saying the template was missing! I didn’t have any issues in the code, but I did have the word Template in the CSS (commented out). I changed it and now the problem is solved!!

    something similar for me too!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No Templates in Edit Page Template is missing???’ is closed to new replies.