Saturday, 17 August 2013

Highlight Blog menu when single post is viewed

Highlight Blog menu when single post is viewed

I am trying to highlight the main blog roll when viewing a single post.
There is only one category for posts and there is no menu showing this
category so I cannot use .current-post-ancestor.
I have the following function, but I am getting errors I do not
understand. The category is "show" and the id of the Blog page is 15
//Highlight Blog Link in main menu when on post page
function post_css_class( $css_class, $page ) {
if (in_category('show') == $page->15 ) {
$css_class[] = '#header .menu .current_page_item a';
}
return $css_class;
}
add_filter( 'page_css_class', 'post_css_class', 10, 2 );`
Thanks for any help

No comments:

Post a Comment