Hi, I would to hide completely menu in php on mobiles. So I wrote this, but it doesn’t work
<?php if ( wp_is_mobile() ) { <div id="logo"></div> } else { wp_nav_menu( array( 'main' => 'site-main' ) ); } ?>
Hi, I would to hide completely menu in php on mobiles. So I wrote this, but it doesn’t work
<?php if ( wp_is_mobile() ) { <div id="logo"></div> } else { wp_nav_menu( array( 'main' => 'site-main' ) ); } ?>
This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.
Hi Vladislav,
You can change this with some custom CSS. If you navigate to AppearanceCustom CSS, you’ll get our custom CSS editor. Just add the following code.
While you can do this with PHP, I wouldn’t recommend it as it’s kind of overkill.
You might also need to install the SiteOrigin CSS Editor.
That’s i know, but dont want to use… I just want ot disable menu in header.php or menu for mobile.
Hi Vladislav,
That’s fine. As always we recommend the use of a child theme when making changes to theme files. Here’s a basic child theme for Vantage already set up.
Make a copy of the file vantage/parts/masthead.php, and open it. Find: get_template_part( ‘parts/menu’ and replace that line with the following PHP.
Thx Man <3 As I want.
so this is the final code for masthead.php
But still have trouble when I try to delete ‘vantage_menu_type’…
Hi Vladislav,
Could you elaborate on the trouble you’re experiencing?
the code working after I deleted ‘vantage_menu_type’, But it working in opposite verse. On desktop there is no menu meanwhile on mobile there is… So I tried to invert etc, but the same thing.
Hi Vladislav,
Based on what you’ve described you should use the following code instead.
Ok, perfect..It’s working! I can’t understand why it didn’t work before…I did as you say upper.
Hi Vladislav,
You were telling it not to display the correct menu by adding the ! to the initial if statement. Is there anything else I can help you with today?
No, thx bro. <3 It's all alright for now