Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed duplicate id issue with secondary nav menu #4259

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion header-footer-grid/Core/Components/SecondNav.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function add_settings() {
*/
public function render_component() {
do_action( 'neve_before_render_nav', $this->get_id() );
Main::get_instance()->load( 'components/component-nav-secondary' );
Main::get_instance()->load( 'components/component-nav-secondary', '', $this->args );
do_action( 'neve_after_render_nav', $this->get_id() );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
namespace HFG;

use HFG\Core\Components\SecondNav;
use HFG\Core\Builder\Header as HeaderBuilder;

$style = component_setting( SecondNav::STYLE_ID );

$style = component_setting( SecondNav::STYLE_ID );
$device_class = isset( $args ) && ! empty( $args ) ? $args['device'] : '';
$container_classes = [ 'nav-menu-secondary' ];

if ( $style !== 'style-plain' ) {
$container_classes[] = $style;
$container_classes[] = 'm-style';
}

$menu_id = SecondNav::COMPONENT_ID . '-' . $device_class . '-' . current_row( HeaderBuilder::BUILDER_NAME );
?>
<div class="nv-top-bar">
<div role="navigation" class="menu-content <?php echo esc_attr( join( ' ', $container_classes ) ); ?>"
Expand All @@ -28,7 +30,7 @@
array(
'theme_location' => 'top-bar',
'menu_class' => 'nav-ul',
'menu_id' => 'secondary-menu',
'menu_id' => $menu_id,
'container' => 'ul',
'depth' => - 1,
'fallback_cb' => '__return_false',
Expand Down
Loading