Monthly Archives: March 2011

Activating a WordPress Child Theme in Code

I ran into this problem while building a mobile version of a WordPress theme. To support a mobile version, I decided to make a child theme that had bare-bones CSS and other mobile goodies. I wanted this child theme to be active when requests came in from known mobile and handheld devices.

Using the filters ‘template‘ and ‘stylesheet‘ in my parent theme’s functions.php , I was able to override the default theme and use my child theme instead.

I hit a snag though, when using get_template_part(). It was ALWAYS deferring to my parent theme for files!
Continue reading