admin管理员组文章数量:1130349
I've created a Dynamic Menu that highlights the selected page and colors for example the blog page "red" while the other links (home, about, contanct) remain white.
My question is how can I make the Dynamic Menu work when say the blog goes to /blog/page/2/ and have the blog remain red instead of dropping the highlight?
Here's the code for my menu.
< nav id="menu" class="mid" role="navigation">
< ?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>
< /nav>
Then, I register the menu inside the functions.php
add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
Here's the CSS that highlights the .current-menu-item
#menu .current-menu-item a {
opacity: 1.0;
}
This is when the Menu is Active on example/work
This is when the Menu is Active on the example/blog *just the first blog page though
This is the menu when it switches to example/blog/page/2, example/work/showcase/website1337
How, can I make it so that the Dynamic Menu detects that /page/2 is still associated with the parent page "/blog/, /work/" and is still highlighted like images 1 and 2?
Thanks :3
I've created a Dynamic Menu that highlights the selected page and colors for example the blog page "red" while the other links (home, about, contanct) remain white.
My question is how can I make the Dynamic Menu work when say the blog goes to /blog/page/2/ and have the blog remain red instead of dropping the highlight?
Here's the code for my menu.
< nav id="menu" class="mid" role="navigation">
< ?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>
< /nav>
Then, I register the menu inside the functions.php
add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
Here's the CSS that highlights the .current-menu-item
#menu .current-menu-item a {
opacity: 1.0;
}
This is when the Menu is Active on example/work
This is when the Menu is Active on the example/blog *just the first blog page though
This is the menu when it switches to example/blog/page/2, example/work/showcase/website1337
How, can I make it so that the Dynamic Menu detects that /page/2 is still associated with the parent page "/blog/, /work/" and is still highlighted like images 1 and 2?
Thanks :3
Share Improve this question edited Jan 11, 2019 at 20:56 Glorfindel 6113 gold badges10 silver badges18 bronze badges asked Feb 6, 2013 at 23:22 Monstr92Monstr92 1371 silver badge10 bronze badges1 Answer
Reset to default 1Test:
#menu current_page_ancestor a { opacity: 1.0; }
Check this Menu Item CSS Classes
I've created a Dynamic Menu that highlights the selected page and colors for example the blog page "red" while the other links (home, about, contanct) remain white.
My question is how can I make the Dynamic Menu work when say the blog goes to /blog/page/2/ and have the blog remain red instead of dropping the highlight?
Here's the code for my menu.
< nav id="menu" class="mid" role="navigation">
< ?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>
< /nav>
Then, I register the menu inside the functions.php
add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
Here's the CSS that highlights the .current-menu-item
#menu .current-menu-item a {
opacity: 1.0;
}
This is when the Menu is Active on example/work
This is when the Menu is Active on the example/blog *just the first blog page though
This is the menu when it switches to example/blog/page/2, example/work/showcase/website1337
How, can I make it so that the Dynamic Menu detects that /page/2 is still associated with the parent page "/blog/, /work/" and is still highlighted like images 1 and 2?
Thanks :3
I've created a Dynamic Menu that highlights the selected page and colors for example the blog page "red" while the other links (home, about, contanct) remain white.
My question is how can I make the Dynamic Menu work when say the blog goes to /blog/page/2/ and have the blog remain red instead of dropping the highlight?
Here's the code for my menu.
< nav id="menu" class="mid" role="navigation">
< ?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>
< /nav>
Then, I register the menu inside the functions.php
add_action( 'init', 'register_my_menu' );
function register_my_menu() {
register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
}
Here's the CSS that highlights the .current-menu-item
#menu .current-menu-item a {
opacity: 1.0;
}
This is when the Menu is Active on example/work
This is when the Menu is Active on the example/blog *just the first blog page though
This is the menu when it switches to example/blog/page/2, example/work/showcase/website1337
How, can I make it so that the Dynamic Menu detects that /page/2 is still associated with the parent page "/blog/, /work/" and is still highlighted like images 1 and 2?
Thanks :3
Share Improve this question edited Jan 11, 2019 at 20:56 Glorfindel 6113 gold badges10 silver badges18 bronze badges asked Feb 6, 2013 at 23:22 Monstr92Monstr92 1371 silver badge10 bronze badges1 Answer
Reset to default 1Test:
#menu current_page_ancestor a { opacity: 1.0; }
Check this Menu Item CSS Classes
本文标签: phpDynamic Menu drops pages
版权声明:本文标题:php - Dynamic Menu drops pages? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749020297a2304275.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论