Saturday 04 February 2012

WordPress 2.7 Page Templates Not Working

iStock_000016286500XSmall

Today I was working on a few minor changes to my site’s design and I wanted to add a few custom page templates to the site. I have been working with WordPress for as long as I can remember and I have used custom page templates extensively in the past. However, today I ran into an apparent bug in the 2.7 version of WordPress.

Here’s the problem…

I uploaded the new custom page template files just like I have always done in the past, but this time they did not show up as options in the WordPress admin area when I went to edit my pages. Normally the drop-down in the page edit area will provide a list of available(correctly coded) page templates. But today, this was not the case.

I did the standard web designer routine…


First: I shouted at the computer and scared my dogs (they don’t understand why I yell at the computer).

Second: I checked and re-checked that I was not making any stupid mistakes.

Third: I visited the WordPress forums only to find a few others with similar problems and no solution.

Fourth: I switched themes and see if the same problem would happen in another theme… It did.

Fifth: I switched back to my main theme and… Presto! Suddenly the pages were showing up.

After doing a little testing I found that for some reason version 2.7 of WordPress is not finding new custom template pages automatically. It seems that currently the only way to get the script to recognize newly added template pages is by temporarily activating another theme and then switching back again. It is a major pain in the ass to say the least, but at least I found a solution and was able to finish what I was doing.

If you have also run into this problem, you likely did some Google searches and ended up here. I just hope you started with the searching online, rather than yelling at the computer like I did.

About the author

Founder of Eos Designs and co-founder of iPrintEasy and a number of other web businesses - an entrepreneur with over 10 years of experience in Internet Marketing - Zach understands what it takes to be successful online and specializes in the development of advertising campaigns and marketing plans for start-ups.
  • http://www.buy-music-stuff.com M

    unfortunately i yelled at the computer also…ranted at it for a little while..until i finally found this post..then i became deeply paranoid i would lose everything if i changed theme…but it worked
    thanks man :)

    • zacheos

      Glad I could help!

  • http://www.thisismyurl.com Christopher Ross

    Thanks! I’ve been staring at my blog for the last hour trying to work out what I was doing wrong.

  • http://www.mptaonline.org/redesign2 Jeremy

    I experienced the same problem. But changing themes ahs not jump-started my templates. They still aren’t showing up. I can see one that I uploaded a couple weeks ago, but not my new ones. Crap!

    Jeremy’s last blog post… Mass Transit in Metro Detroit

  • Jamiel Sharief

    I just experienced the same thing and I created numerous different templates, all the templates suddenly appeared once I changed to a different theme.

    Try switching themes, then quick edit the page to see if this works for you.

  • http://www.richardegil.com Richard

    Worked like a charm… I was one step away from throwing my computer against the wall ;)

    Thanks!

    • zacheos

      Nice! I know the feeling… Nothing like KNOWING you are right and having the computer (or software, or browser, or database) disagree with you!

  • http://www.ifgogo.com/ Aw Guo

    Hey thanks! It’s a very important tip for me!!!

    Aw Guo’s last blog post… Huge fire burning near CCTV headquarter building on Feb 9

  • http://www.laurawieler.com Laura

    Thanks so much for this handy bit of information. I am currently using the plugin “Theme Test Drive” 2.7.2 by Vladimir Prelovac, and therefore was not working on the officially active theme, but your lovely solution still worked like a charm :-)

  • http://twitter.com/PeterVk PeterVk

    Thanks for finding this. I can see absolutely no connection between temporarily switching themes and having new page templates be recognized. I don’t know if I would have found it myself. Cheers. Works perfectly.

    PeterVk’s last blog post… PeterVk: Seriously, WordPress. I know you have a lot of bugs to fix, but please make this a priority: http://bit.ly/lbo77 머리 아파…

  • http://TasteLikeCrazy.com Amy @ Taste Like Crazy

    Blarg!

    I tried switching themes and still can’t get the stupid things to show up. Now I’m off to check to make sure that I haven’t made any coding mistakes. Based on the positive responses that you’ve gotten so far, I’m going to assume that I’m screwing up somewhere along the way. *sigh*

    Amy @ Taste Like Crazy’s last blog post… MilkBank – All in One Bottle

    • zacheos

      Good luck… Love your site by the way! Very interesting writing voice.

      • http://TasteLikeCrazy.com Amy @ Taste Like Crazy

        Thanks! Guess what? Totally worked. I was just being impatient. :)

        Amy @ Taste Like Crazy’s last blog post… Did You Say Shredder?

  • Runar
    • zacheos

      Thanks for the link… However, the problem is that sometimes this does not work like it is supposed to. For reasons beyond the scope of this article, WordPress 2.7 will fail to “see” new page templates have been added to the system. In this case, you will need to follow the steps provided above to force WordPress to “refresh” its view of the current directory structure.

    • http://100-stories.com/ Kamrul

      The real answer. thanks.

  • Pingback: WordPress Custom Page Templates Not Showing In Dropdown Menu | Van SEO Design

  • http://www.slightlydifferent.co.uk Russ

    Thanks for this post. This had happened to me a couple of times before – I fixed it through sheer luck, but always forgot what the solution was. Considered this page bookmarked.

  • http://www.dreamsinplay.org Andrew Kelley

    My Page template dropdown in the wp 2.7 admin menu totally disappeared when I go to edit the page. When I quick edit, there is only default in the dropdown even though I have about half a dozen page templates which use to show up!!!

    Thanks in advance for your time and consideration!

  • http://www.acceleratingchange.org Tim Sewell

    Thank you very much (although Dell won’t thank you as I would have had to buy a new computer after treating this one to the sledgehammer).

  • http://glenmcniel.com ZenGlen

    Thank you Zach! I think you PREVENTED me from having problems with that. I am just about to do a bunch of custom templates for a customer. Would have been a little embarrasing to get delayed by such a quirky problem.

    Keep on rockin’ my man.

  • http://www.techieminds.org Himanshu

    yeah, I am too facing the same issue, this is an bug within wordpress 2.7.

    ~Himanshu~

    Himanshu’s last blog post… Recession hits dinosaurs

  • http://www.currentopics.com/ anjul bamhrolia

    HELLO THERE
    I GOT A PROBLEM ,
    MY RECENT POST LINK IS DIFFERENT( SHOWING IN SIDE BAR) AND MY POST LINK IS DIFFERENT , SO WHEN SOME BODY CLICK ON MY RECENT POST LINK ,THEN IT DOESN’T OPEN MY POST PAGE PLS HELP ME (RECENT POST LINK LOKE LIKE”http://www.currentopics.com/?p=126″ AND MY ACTUAL POST LINK LOOK LIKE”http://www.currentopics.com/?paged=3″)

  • http://www.currentopics.com/ anjul bamhrolia

    pls help me my comment page also not showing, all blank, and when i switch to an other theme it all blank NO POST NOTHING……. my email-anjforeva@gmail.com my blog-http://www.currentopics.com/

    anjul bamhrolia’s last blog post… What is Terrorism ?

  • http://moneysavinginsurancereviews.com Bradley

    Hey Zach -

    I tried your suggestion with no luck… any other ideas?

    Such a PITA!!!

    Bradley’s last blog post… Health Insurance Nightmares – Annual Rate Increases Too High To Keep Up With

  • Gianfranco

    It is just not acceptable to have to do this kind of workaronds for something that should just work. The WordPress guys are better fixing this problem as soon as possible. We shouldn’t be happy to find a solution for such a problem. We should all be mad that we have to waste a lot of time trying to figure things (bugs) out and to look for solutions on the net. It should just work, shouldn’t it? My point is that we should make some noise in the ears of the WordPress people, instead of just saying, oh, ok I found a way to make it work. Switching theme every time you want to apply a template to a page? C’mon! It just drives me crazy, when a basic function don’t work the way it is menat to.

  • Gianfranco

    Just found a very weird fix to the “template dropdown menu” not showing under the “attribute box” in “pages”. Actually, in my “style.css” file I had something written for “template”.

    /*
    Theme Name:
    Theme URI:
    Description:
    Author:
    Author URI:
    Template:
    Version: 2.0
    */

    I just removed it and the “template” function just work. When I write something in the “template” line, the function is broken again. Weird!

    • zacheos

      That is very strange indeed… I would have to do a bit of testing to understand why the style sheet would be related to this bug.

  • http://directoryofcostablanca.com/blog Jacqueline

    I’m gonna try this before I go totally doolally

  • http://www.allaboutauto.us mssmotorrd

    It’s the first time I commented here and I must say you share us genuine, and quality information for bloggers! Good job.
    p.s. You have a very good template for your blog. Where did you find it?

    • zacheos

      Thanks for reading my blog! I run this site as nothing more than a hobby, so it is always nice to hear that my efforts are appreciated. This site was of course designed by me, and if you read it often you know that I am always changing it. Give it a couple of months and I am sure I will change it again.

  • http://www.moebiuscreative.com AMP

    Thank you! This has been confounding me for the last 30 minutes or so.

    I actually even thought to toggle themes, but then I thought, “Nah, that’s too easy, and it doesn’t make sense.” Go figure.

  • http://bizlift.com Sterling Okura

    Thanks for posting the solution. Saved me some headaches. Can’t believe that WordPress doesn’t have a better option for refreshing page templates.

    You rock!

  • Sean

    Thanks for your help!

  • http://artinsighttv.com Art Insight TV

    Thanks Zach! I’ve had that issue on two sites now. Hopeful never again! Time to go a make the donuts and swap themes.

    Thanks

    Art Insight TV’s last blog post… John Singer Sargent

  • http://www.thirtypointfour.com.au mark

    Thanks Zach, this was an instant fix to a realy anoying problem. Simple, switch themes and switch back and bobs your uncle!! cheers

    mark’s last blog post… Saving images for email & the web

  • http://www.garethdickey.com/ Gareth Dickey

    Cheers Zach, great post mate. Worked a treat. Freaking weird bug!

  • Kalle

    Thanks!
    Great help.

  • http://www.aboundmarketing.com Harvey Ramer

    Thanks very much for this. I had the same problem with 2.8.6. This fixed it.

  • http://www.casualtyofdesign.com Echo

    THANK YOU SOOOOO MUCH!!! SAVED ME A BUNCH OF TIME!

  • http://www.mindlessconception.com Derek

    You just saved me so much trouble! Thank goodness I only goofed around with it for 20 minutes before firing up Google.

    Looks like the bug still exists in 2.9.1. First time ever encountering it, and I’ve been playing around with WordPress since about version 2.6.

  • http://www.v5ds.com Anton Korzhuk

    thanks! step 5 was a real live saver, saved me the freak out time.heh

  • http://theodin.co.uk phil

    Nice one, really helped me out. Looks like the same issue occurs if you delete the default stylesheet from the theme directory too.

  • Timmy

    Thanks!!!!!!!!!!!!!!!! It works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    I’ve spent 5 hours to find what is wrong!

  • http://intensedebate.com/profiles/lukeslytalker Nate Balcom

    Thank you so much. I was starting to lose my mind. I've been working with WordPress for years and haven't run into this issue yet. A simple template change and then back and viola. By the by I know this is an older post this also works with the newest version of WordPress 2.9.2. Thanks a ton:)

  • Jordan

    Thanks a lot for the tips. It works! :D

  • starticsblog

    The bug still remains in 3.0.1I did it and the dropwdown worked.. although my main menu is now a disaster!

  • http://xpdrivers.com/index.cfm JMontes

    Am pretty sure its now working on its later version.

  • Lamia

    Thankyouthankyouthankyou! Was convinced that I was just NOT getting it!

  • Jonathon Blakeley

    It looks like I have this problem too. I have wordpress website where new templates don’t appear. Tried switching themes no joy … Puzzled.

  • S. Naoum

    Had the same problem today, not sure what triggered it as I was editing some template files and the box disappeared.

    Switching themes back and forth did NOT fix it. I had to delete my custom theme folder from the server and upload it again.

    Thanks for this article, it put me on the right track of knowing it is WordPress misbehaving, so I did not have to wrestle with the code for hours thinking I broke something.

  • Adrianadelmonaco

    THANK YOUUUUU I LOVE YOUUUU!!! You saved me!

Powered by WordPress | Privacy Policy | Web Design Miami