TEMPLATEPATH not compatible with child themes
-
Hi there,
I was trying to override the default single FAQ template in my child theme and was struggling to figure out what was happening. I should be able to place a single-qa_faqs.php into my theme and create a custom template for a single FAQ. This is the way the standard WP templating engine works. See: https://codex.www.ads-software.com/Template_HierarchyI found the problem here (line 103 of function.php):
if ( is_single() && 'qa_faqs' == get_post_type($post) ) { if ( file_exists( TEMPLATEPATH . '/single-qa_faqs.php') ) { $page_template = TEMPLATEPATH . '/single-qa_faqs.php'; } elseif ( file_exists( TEMPLATEPATH . '/page.php') ) { $page_template = TEMPLATEPATH . '/page.php'; } elseif ( file_exists( TEMPLATEPATH . '/single.php' )) { $page_template = TEMPLATEPATH . '/single.php'; } else { $page_template = TEMPLATEPATH . '/index.php'; } }
That TEMPLATEPATH constant is only going to work on themes that are parent themes. This is a big problem for anyone using theme frameworks such as Genesis.
- The topic ‘TEMPLATEPATH not compatible with child themes’ is closed to new replies.