I have a template page that is supposed to load all blog posts(posts stream) and I am working in child theme. For some reason I get index.php returned from parent theme instead of modified one that I have in child theme directory.
code:
<?php
/*
Template Name: Blog
*/
// Which page of the blog are we on?
$paged = get_query_var('paged');
query_posts('cat=-0&paged='.$paged);
//load index to show blog
load_template(TEMPLATEPATH . '/index.php');
?>
Any ideas how to solve this, so it loads child theme index.php instead of parent?
In your context you use the wrong constant. You must use the constant STYLESHEETPATH
for the path to the active child theme. The constant TEMPLATEPATH
get the path to the parent theme, that was referenced in the child theme.
But, a important hint. The constant is deprecated, see the ticket #18298 for more information. That’s is the point that you should use the function get_stylesheet_directory()
to get the right path.
Additional also the hint, also the constant TEMPLATEPATH
is deprecated and also here the hint to use the associated function get_template_directory()
.