carlsen.rasmus
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: breadcrumb-list not on front-pagethanks,
I did that, but it did’nt work, but when I look closer, I can se my typing-F***.
Now it works just fine.
ras
Forum: Fixing WordPress
In reply to: is_single OR is_category troubleps: blog-excerpts.php is a template …
Forum: Fixing WordPress
In reply to: is_single OR is_category troubleStrange: this works as it should,
add_filter( ‘nav_menu_css_class’, ‘add_custom_class’, 10, 5 );
function add_custom_class( $classes = array(), $menu_item = false ) {
if ( (is_single() || is_category())
&& 44 == $menu_item->ID
&& ! in_array( ‘current-menu-item’, $classes ) ) {
$classes[] = ‘rasmus-test’;
}
return $classes;
}
but if I ad the is_archive … it highlights the menu-item all the time.ras
Forum: Fixing WordPress
In reply to: is_single OR is_category troublesorry – it does’nt work. It highight the menu-item (with id 44) all the time …
ras
Forum: Fixing WordPress
In reply to: is_single OR is_category troublethen I can just stay with:
add_filter( 'nav_menu_css_class', 'add_custom_class', 10, 4 ); function add_custom_class( $classes = array(), $menu_item = false ) { if ( (is_single() || is_category || is_archive()) && 44 == $menu_item->ID && ! in_array( 'current-menu-item', $classes ) ) { $classes[] = 'rasmus-test'; } return $classes; }
it works just fine – however, in af child-theme it would be better for later theme-use, that it was based on something else than “44”.
ras
Forum: Fixing WordPress
In reply to: is_single OR is_category troublethanks! How blind can I be!
this did it:
if ( (is_single() || is_category()) && 44 == $menu_item->ID && ! in_array( 'current-menu-item', $classes ) )
However – I dont get how to incert the menu-item ID by the templatename …
this:
add_filter( 'nav_menu_css_class', 'add_custom_class', 10, 4 ); function add_custom_class( $classes = array(), $menu_item = false ) { if ( (is_single() || is_category || is_archive()) && ( is_page_template('blog-excerpt.php')) && ! in_array( 'current-menu-item', $classes ) ) { $classes[] = 'rasmus-test'; } return $classes; }
… wont work. It highligt all menu-items except the one base on blog-excerpt ??
ras
Forum: Fixing WordPress
In reply to: Highlight parent-page (as menu item) on subpagesSolved (almost):
this:
.menu .current_page_item a, { background-color: #343434; }
went to this
.menu .current_page_item a, li.current-page-ancestor a, { background-color: #343434; }
However; still need to find out how to do the same trick with post and categories.
ras