hello,
if you are using the child theme, then copy the mobile navigation file in the child theme folder.
get the file from here – go to themes\oceanwp\partials\mobile and copy the mobile-nav.php.
Now open child theme function.php file and register a sidebar widget.
Don’t forget to call it in your mobile-nav.php file of the child theme within div id ‘mobile-nav’.
Go to appearance > widgets > find newly created sidebar and add your widgets.
Hope it will help you.
Thread Starter
VM06
(@vm06)
Hello Amit,
Thanks for your answer. So I did all the steps but nothing appears on mobile menu. I even added an “echo” but there is nothing that is displayed.
Do you have any idea?
Thanks.
can you send the screenshot of your widget area? appearance > widgets. what is the name of your newly registered sidebar?
-
This reply was modified 6 years, 7 months ago by
Amit Singh.
Thread Starter
VM06
(@vm06)
Thanks. How do we add a screenshot?
Use any screen capturing tool such prntscr or awesome capture and share the link here.
Thread Starter
VM06
(@vm06)
Here is the screenshot (of the widget area and also the area where I would like to display the menu).
Thanks.
Widget header
Mobile menu
-
This reply was modified 6 years, 7 months ago by
VM06.
-
This reply was modified 6 years, 7 months ago by
VM06.
Your links are broken. Please share the valid link.
Thread Starter
VM06
(@vm06)
Sorry, it was working for me.
Menu mobile
Header widget
Did you call the registered sidebar in mobile-nave.php file?
Add a widget in the widget header (appearance > widget) and check it is working or not.
Thread Starter
VM06
(@vm06)
Yes, I already registered sidebar :
function header_widgets_init() {
register_sidebar( array(
'name' => 'Widget Header',
'id' => 'widget_area' ) );
}
add_action( 'widgets_init', 'header_widgets_init' );
In child theme folder :
<div id="mobile-nav" class="navigation clr">
<!-- ajout de ma nouvelle widget area -->
<?php if ( is_active_sidebar( 'widget_area' ) ) : ?>
<div id="header-widget-area" class="nwa-header-widget widget-area" role="complementary">
<?php dynamic_sidebar( 'widget_area' ); ?>
</div>
<?php endif; ?>
<!-- fin nouvelle widget area -->
<?php
// Display menu
wp_nav_menu( $menu_args ); echo("bonjour");?>
</div>
Hello, Go to appearance > menus and also tick the mobile menu (optional) checkbox. It will work as you want.
Don’t forget to add widgets in the newly registered sidebar. Go to appearance > widgets and add widgets.
Thread Starter
VM06
(@vm06)
Hello Amit,
That’s perfect, it is working. Thanks so much.
And just one thing : is it possible to have the search form before navigation (as in mobile-nav.php, it is not possible to reverse nav and search form)?
Thanks.
Hello,
Add this code to reverse the order.
#sidr {
display: -webkit-flex;
display: flex;
flex-direction: column;
}
#sidr > .sidr-inner:nth-child(2) {
order:3;
-webkit-order:3;
}
#sidr > .sidr-inner:nth-child(3) {
order:2;
-webkit-order:2;
}
#sidr > .sidr-inner:nth-child(2) ul li:first-child {
border-top:none;
margin-top:25px
}
Thread Starter
VM06
(@vm06)
Hello Amit,
Thanks so much for all your help, as always :).