problem with custom single post templates and current_page_parent
-
hi
I have a main blog section on my site and a case studies section.
Both contain psots filtered by their category (main_blog, or casestudy).I’m using he following solution in functions.php to allow sustom single post templates
// allow single post page templates add_filter('single_template', create_function('$t', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . "/single-{$cat->term_id}.php") ) return TEMPLATEPATH . "/single-{$cat->term_id}.php"; } return $t;' ));
Hover if i click on a case study for example – to view it’ single post, it used the correct template (in this case single-5.php) but the current_page_parent class from my main nav (using wp_page_menu) switches to the main blog section.
Does anyone know of a way to force each single post template to set the correct ‘current_page_parent’ in the main menu?
Many many thanks
Mark
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘problem with custom single post templates and current_page_parent’ is closed to new replies.