I managed to make the current menu item black and underlined when the header is on top of the page. But it’s not the case any more with the sticky menu that appears on scroll (the current menu item is grey and not underlined, which I don’t want). I would like to have the same style for the sticky header as for the top header.
Thanks!
]]>Is there a way to replace the initial value by the current selected menu item ?
Example if user select “Cars”, it will be displayed instead of “Select page”
if he select “Moto”, it will be displayed instead of “Select page” etc…
Thanks in advance for your help
]]>[Please advise using the demo site as the example as my site is in still in development.]
I would like the main navigation’s menu items to change style (e.g. from black and normal weight to orange and bold) when the corresponding active page is shown. This is to help users to orient to where they are in the site as Portfolio page is used as my Homepage. I have 4 main navigation links (Portfolio, Blog, About Me, Contact). I tried this code but it only seems to work some of the time:
.nav-menu .current-menu-item > a,
.nav-menu .current-page-item > a,
.nav-menu .current-menu-item > ul > li > a,
.nav-menu .current-page-item > ul > li > a
{
color: #F35029;
font-weight: bold;}
Thank you!
]]>li.current_page_item
I have tried to style that with no luck.
Anyone know a fool-proof way that works with this template? I’m fine with the style coding, just not able to pick the right element.
Thanks
]]>HOME (using custom url)
PHOTOGRAPHY (CPT archive page archive-photography.php)
FIELD JOURNAL(CPT archive page archive-fieldjournal.php)
INFORMATION (using page.php)
photography and field journal aren’t highlighting for some reason. I’m assuming that because I set up the CPT’s as pages instead of just leaving them as an archive is messing with things? But that has never happened to me before. I’ve done this many times. Here’s a bit more info…
(header.php)
<?php $args = array('theme_location' => 'primary'); ?>
<?php wp_nav_menu($args); ?>
(functions.php)
register_nav_menus(array(
'primary' => __('Primary Header Menu'),
'footer' => __('Primary Footer Menu')
));
(HTML output)
<ul>
<li id="menu-item-76" class="menu-item menu-item-type-custom menu-item-object-custom
current-menu-item current_page_item menu-item-home menu-item-76"><a
href="https://localhost/wordpress">Home</a>
</li>
<li id="menu-item-281" class="menu-item menu-item-type-post_type menu-item-object-
page menu-item-281"><a href="https://localhost/wordpress/photography/">Photography</a>
</li>
<li id="menu-item-284" class="menu-item menu-item-type-post_type menu-item-object-
page menu-item-284"><a href="https://localhost/wordpress/field-journal/">Field
Journal</a>
</li>
<li id="menu-item-119" class="menu-item menu-item-type-post_type menu-item-object-
page menu-item-119"><a href="https://localhost/wordpress/information/">Information</a>
</li>
</ul>
]]>Since 1.1.7 version, my current page menu item is not highlighted anymore.
In fact, current-menu-item and current-page-* classes are absent from code while they were present in 1.1.6 version.
This issue occurs only with Beaver Builder 1.11, not with BB 2.0.3.1… but i can’t upgrade to BB 2 since it breaks things in my site (currently trying to solve this with BB support).
Would it possible to fix this so BB Header Footer handles current page classes in menu for both BB 1 & 2?
Thanks!
]]>if( in_array( 'current-menu-item', $classes ) ):
<img src="<?=get_post_meta($item->ID, '_om_aitm_attached_image', true);?>">
Code
filter
add_filter( 'nav_menu_css_class', array( $this, 'om_aitm_nav_menu_css_class'), 10, 2 );
Callback function
Problem: This image insert in the “nav” tag. I want to insert the image before/after the “nav” tag.
function om_aitm_nav_menu_css_class( $classes, $item )
{
if( in_array( 'current-menu-item', $classes ) ):
?>
<img src="<?=get_post_meta($item->ID, '_om_aitm_attached_image', true);?>">
<?php
endif;
return $classes;
}
]]>I just started this web today, and having trouble with the current menu item color … I know I am targeting it right because it shows the underline decoration.
But is the color: that is not changing.
Please help!
Thanks
This is the web