Fatal error Call to undefined function twentytwelve_content_nav()

I was adding an item into the custom menu when this happened. Prior to this, I had just uploaded a page template from my machine’s localhost. Everything was working fine.
So what exactly causes this fatal error, I really have no idea.
The child theme stopped working and TwentyTwelve took over to become the default theme.
In the admin area, this is what the theme looked like. It didn’t appear normal. The name, the description and other text within the remark looked unwrapped.

WP Theme Selection Area
ChildThemeLooksBrokenInAdminArea

The Fix

These are some of the attempts made:

  • Re-upload the child theme
  • Re-upload twenty twelve
  • Switch FTP transfer mode from auto to ascii and repeat the above.
  • Remove all other files except the style.css
  • Remove index.php
  • Renaming the child theme
  • Upload function.php to the childtheme folder – it calls for another file in twentytwelve

Nothing worked.

This could have been a solution

I was contemplating on renaming TwentyTwelve to something else and add the styling of the child-theme to the main style.css.
But I would have to rename all occurrence of “twentytwelve” in the templates in new theme folder to a new name or else some of the template will run into error.
That looks like too much work.
So, before jumping into it, let me fix the style.css one more time.

And Finally…

I deleted everything in the style.css except those that commented for the theme; That is, delete everything except those from /* to */
As usual it still looks normal in localhost but not when uploaded to the server.
I opened up a new text file and retype everything from /* to */, uploaded, and Bingo!
This looks normal now…
That means the cause of the error comes from those text in the commented area.
It doesn’t make much sense to me. What works in localhost doesn’t worked at the server.
And the cause is the text in the commented area.

Recap for the Fix

Redo the style.css of the child theme from scrap. Do not copy and paste. Or if you must copy to avoid typo, do not copy from the file that gave the error. Copy from twentytwelve and make changes.
If you ever encounter this same problem. Fix the style.css first.
Of course, what works for me may not worked for you. It may be the same error but caused by a different source. I am no PHP expert and I do not understand the WordPress engine.
Total time spent – 4 hours. If you engaged me to fix the error, and if I were to charge $50 an hour, that would have costed you $200.
Learn to be your own webmaster.

One thought on “Fatal error Call to undefined function twentytwelve_content_nav()

Leave a Reply

Your email address will not be published. Required fields are marked *