How to set full/mobile menu switching & padding
-
Hello,
The menu appears OK at 1920 pixels wide. However at lower width resolutions, menu items with more than one word wrap, then at a specific width, the menu switches to the mobile menu with the bars.
1) I would like for the full menu to switch to the mobile menu sooner, but I can’t see a setting in admin to achieve this.
2) I would also like the padding/margin around the menu to be reduced so the header uses less height, and I again can’t find a setting to achieve this.
See screen recording here: https://a.cl.ly/YEu4zRLD
Any help configuring the above would be appreciated.
Thank you,
BharatThe page I need help with: [log in to see the link]
-
Hi @bharatk,
I would like for the full menu to switch to the mobile menu sooner, but I can’t see a setting in admin to achieve this.
I checked your site, and I see you seem to have resolved this one. Have you added custom CSS to solve this? My understanding is that the menu should “collapse” automatically when there is an overlay, so I think it is odd that it was not working this way.
I would also like the padding/margin around the menu to be reduced so the header uses less height, and I again can’t find a setting to achieve this.
Have you tried to change the dimensions for the group block for the menu?
Full Size: https://d.pr/i/wydrhw@foosantos I haven’t resolved the menu switching to mobile view a little earlier. May I ask why you think I have (i.e. was it switching earlier for you)?
With regards to the space around the menu, there is only bottom padding of 1 which I added otherwise the menu had a large gap at the top (which I can’t reduce) and the bottom gap was too small compared to the top and it looked odd. See here: https://a.cl.ly/Bluzqjgy
Any suggestions would be appreciated.
Thank you,
BharatHi @bharatk,
I haven’t resolved the menu switching to mobile view a little earlier. May I ask why you think I have (i.e. was it switching earlier for you)?
Yes, I can’t remember precisely how it was showing, but I can reproduce your issue anyway now.
In this case, do you know if this was working as expected before?
While it is not possible to change that without changing the theme or using custom code, this shouldn’t apply this way. Maybe it has some custom code changing how it should work natively?
With regards to the space around the menu, there is only bottom padding of 1 which I added otherwise the menu had a large gap at the top (which I can’t reduce) and the bottom gap was too small compared to the top and it looked odd. See here: https://a.cl.ly/Bluzqjgy
Actually, if you click this “settings icon”, it should allow you to set a custom padding/margin:
Full Size: https://d.pr/i/nwe3cwHello @foosantos
The menu hasn’t switched as expected since I started using the theme, and I have not added any custom code. If you can suggest any custom code to earlier switch the text menu to the 2/3 bars icon then I would appreciate it.
Re: space around the menu, I can reduce the size of the space under the menu when selecting the group and then using the settings icons, however it’s the top that I can’t change (see here: https://a.cl.ly/7KuWn91X). It seems there a space between the very top of the header down to the top of the group which can’t be selected and then configured. That is why I left the bottom space unchanged which matches the top until I can reduce both. Any suggestions would be appreciated.Thank you,
Bharat
Hi @bharatk,
Thank you for the additional details.
The menu hasn’t switched as expected since I started using the theme, and I have not added any custom code. If you can suggest any custom code to earlier switch the text menu to the 2/3 bars icon then I would appreciate it.
This is likely caused by a conflict with a plugin. Have you tried a conflict test?
How to test for conflicts
The best way to determine if the issue is being caused by a plugin is to:
1. Temporarily deactivate all plugins. You can do this manually or use a plugin to help (see below for tools).
2. Try to reproduce the problem. If the problem is resolved, it’s a plugin conflict. To figure out which plugin is causing the problem, continue to the next step.
3. Reactivate your other plugins one by one, testing after each, until you find the one causing conflict.Recommended tools to help with troubleshooting
* Meks Quick Plugin Disabler will remember what plugins you had active when you switch it back on.
* You can clone your site to a staging environment and perform tests without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.Re: space around the menu, I can reduce the size of the space under the menu when selecting the group and then using the settings icons, however it’s the top that I can’t change (see here: https://a.cl.ly/7KuWn91X). It seems there a space between the very top of the header down to the top of the group which can’t be selected and then configured. That is why I left the bottom space unchanged which matches the top until I can reduce both. Any suggestions would be appreciated.
Thank you for the screenshot!
I see your point now. This is happening because of the padding set to the top of the site (not to the header itself).
You can go to Style options, then access Layout and change it from there for the top padding:
Full Size: https://d.pr/i/Pt8wJW@foosantos thank you again for looking into this. It’s appreciated.
I created a staging site, switched off all the plugins and saw how the menu displays in an incognito window. It still doesn’t switch to the mobile menu icon early enough. See screen recording here: https://a.cl.ly/JrueZ61g and you can access the staging site with all the plugins switched off here: https://karavadra.net/staging
With regards to changing the padding in Style options and then Layout, that worked, together with removing and readjusting some padding on the group in which the navigation sits. I didn’t even see the padding in Style>Layout. Thank you.
The switching to mobile menu above remains a mystery. Any suggestions would be appreciated.
BharatHi @bharatk,
I’m glad that the padding issue for the header is resolved now.
Regarding the menu switching to mobile, could you share?the code?from this header block? Example on how to copy the code: https://d.pr/i/Id8rV6
Also, could you go to Tools > Site Health > Info, then click “Copy site info to clipboard”? After that, can you please share it here? There is no need to share the full report, but I would appreciate it if you could share the plugin/theme details from it.
@foosantos , thank you for continuing to look into this. It’s appreciated.
I’ve just updated to WordPress 6.3 so please consider that going forwards.
Selecting the header and copying the code in 6.3 was slightly different as here: https://a.cl.ly/Z4uGEBbX
The code is below:
<!-- wp:template-part {"slug":"header","theme":"twentytwentythree","tagName":"header"} /--> <!-- wp:group {"tagName":"main","style":{"spacing":{"margin":{"top":"var:preset|spacing|30"}}}} --> <main class="wp-block-group" style="margin-top:var(--wp--preset--spacing--30)"><!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|vivid-green-cyan"}}}},"textColor":"contrast","layout":{"type":"constrained","wideSize":"1080px"}} --> <div class="wp-block-group has-contrast-color has-text-color has-link-color"><!-- wp:post-title {"level":1,"align":"wide","style":{"spacing":{"margin":{"bottom":"0","top":"0px"},"padding":{"top":"0"}},"typography":{"fontStyle":"normal","fontWeight":"700","fontSize":"3rem"}}} /--> <!-- wp:post-featured-image /--></div> <!-- /wp:group --> <!-- wp:spacer {"height":"20px"} --> <div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div> <!-- /wp:spacer --> <!-- wp:post-content {"layout":{"type":"constrained","contentSize":"1080px"},"fontSize":"medium","fontFamily":"dm-sans"} /--> <!-- wp:template-part {"slug":"comments","theme":"twentytwentythree","tagName":"section"} /--></main> <!-- /wp:group --> <!-- wp:template-part {"slug":"footer","theme":"twentytwentythree","tagName":"footer"} /-->
I hope that’s OK. Let me know if otherwise.
The Site Health info is below:` ### wp-core ### version: 6.3 site_language: en_GB user_language: en_GB timezone: Europe/London permalink: /%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: open environment_type: production user_count: 6 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /home/tryittv/public_html/karavadranet wordpress_size: 1.05 GB (1122538524 bytes) uploads_path: /home/tryittv/public_html/karavadranet/wp-content/uploads uploads_size: 562.67 MB (590005601 bytes) themes_path: /home/tryittv/public_html/karavadranet/wp-content/themes themes_size: 51.42 MB (53916356 bytes) plugins_path: /home/tryittv/public_html/karavadranet/wp-content/plugins plugins_size: 143.36 MB (150319040 bytes) database_size: 44.49 MB (46652154 bytes) total_size: 1.83 GB (1963431675 bytes) ### wp-active-theme ### name: Twenty Twenty-Three (twentytwentythree) version: 1.2 author: the WordPress team author_website: https://en-gb.www.remarpro.com parent_theme: none theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, block-templates, widgets-block-editor theme_path: /home/tryittv/public_html/karavadranet/wp-content/themes/twentytwentythree auto_update: Disabled ### wp-themes-inactive (2) ### Salient Child Theme: version: 1.0, author: ThemeNectar, Auto-updates disabled Salient: version: 15.0.7, author: ThemeNectar, Auto-updates disabled ### wp-mu-plugins (1) ### Health Check Troubleshooting Mode: author: (undefined), version: 1.9.0 ### wp-plugins-active (16) ### AddToAny Share Buttons: version: 1.8.7, author: AddToAny, Auto-updates disabled Better Notifications for WP: version: 1.9.3, author: Made with Fuel, Auto-updates disabled PHP Code For Posts: version: 2.2.2.1, author: Jamie Fraser, Auto-updates disabled Pretty Links: version: 3.5.1, author: Pretty Links, Auto-updates disabled Search Exclude: version: 2.0.3, author: QuadLayers, Auto-updates disabled Site Kit by Google: version: 1.106.0, author: Google, Auto-updates disabled Stop Spammers: version: 2023.3, author: Trumani, Auto-updates disabled Thrive Automator: version: 1.14, author: <a >Thrive Themes</a>, Auto-updates disabled Thrive Comments: version: 2.21, author: <a >Thrive Themes</a>, Auto-updates disabled Thrive Leads: version: 3.21.2, author: <a >Thrive Themes</a>, Auto-updates disabled Thrive Product Manager: version: 1.13, author: Thrive Themes, Auto-updates disabled UpdraftPlus - Backup/Restore: version: 1.23.7, author: UpdraftPlus.Com, DavidAnderson, Auto-updates disabled Wicked Folders: version: 2.18.18, author: Wicked Plugins, Auto-updates disabled WPCode Lite: version: 2.1.0, author: WPCode, Auto-updates disabled WP Compress | Image Optimizer: version: 6.10.24, author: WP Compress, Auto-updates disabled WP Mail SMTP: version: 3.8.2, author: WP Mail SMTP, Auto-updates disabled ### wp-plugins-inactive (2) ### Health Check & Troubleshooting: version: 1.7.0, author: The www.remarpro.com community, Auto-updates disabled WP-Optimize - Clean, Compress, Cache: version: 3.2.16, author: David Anderson, Ruhani Rabin, Team Updraft, Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: File uploads is turned off post_max_size: 32M upload_max_filesize: 32M max_effective_size: 32 MB max_file_uploads: 20 gd_version: 2.3.3 gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF, XPM ghostscript_version: 9.27 ### wp-server ### server_architecture: Linux 4.18.0-348.lve.el8.x86_64 x86_64 httpd_software: LiteSpeed php_version: 8.1.13 64bit php_sapi: litespeed max_input_variables: 1000 time_limit: 120 memory_limit: 256M admin_memory_limit: 1024M max_input_time: 120 upload_max_filesize: 32M php_post_max_size: 32M curl_version: 7.87.0 OpenSSL/1.1.1p suhosin: false imagick_availability: false pretty_permalinks: true htaccess_extra_rules: true current: 2023-08-09T10:45:48+00:00 utc-time: Wednesday, 09-Aug-23 10:45:48 UTC server-time: 2023-08-09T11:45:47+01:00 ### wp-database ### extension: mysqli server_version: 8.0.33-cll-lve client_version: mysqlnd 8.1.13 max_allowed_packet: 268435456 max_connections: 4000 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /home/tryittv/public_html/karavadranet/wp-content WP_PLUGIN_DIR: /home/tryittv/public_html/karavadranet/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### google-site-kit ### version: 1.106.0 php_version: 8.1.13 wp_version: 6.3 reference_url: https://karavadra.net amp_mode: no site_status: connected-site user_status: authenticated verification_status: verified-non-site-kit connected_user_count: 1 active_modules: site-verification, search-console, analytics, analytics-4, pagespeed-insights recoverable_modules: none required_scopes: openid: ? https://www.googleapis.com/auth/userinfo.profile: ? https://www.googleapis.com/auth/userinfo.email: ? https://www.googleapis.com/auth/siteverification: ? https://www.googleapis.com/auth/webmasters: ? https://www.googleapis.com/auth/analytics.readonly: ? https://www.googleapis.com/auth/tagmanager.readonly: ? capabilities: googlesitekit_authenticate: ? googlesitekit_setup: ? googlesitekit_view_posts_insights: ? googlesitekit_view_dashboard: ? googlesitekit_manage_options: ? googlesitekit_update_plugins: ? googlesitekit_view_splash: ? googlesitekit_view_authenticated_dashboard: ? googlesitekit_view_wp_dashboard_widget: ? googlesitekit_view_admin_bar_menu: ? googlesitekit_view_shared_dashboard: ? googlesitekit_read_shared_module_data::["search-console"]: ? googlesitekit_read_shared_module_data::["analytics-4"]: ? googlesitekit_read_shared_module_data::["pagespeed-insights"]: ? googlesitekit_manage_module_sharing_options::["search-console"]: ? googlesitekit_manage_module_sharing_options::["analytics-4"]: ? googlesitekit_manage_module_sharing_options::["pagespeed-insights"]: ? googlesitekit_delegate_module_sharing_management::["search-console"]: ? googlesitekit_delegate_module_sharing_management::["analytics-4"]: ? googlesitekit_delegate_module_sharing_management::["pagespeed-insights"]: ? enabled_features: adBlockerDetection: ? adsenseSetupV2: ? dashboardSharing: ? ga4Reporting: ? gm3Components: ? userInput: ? search-console_shared_roles: none search-console_management: owner analytics-4_shared_roles: none analytics-4_management: owner pagespeed-insights_shared_roles: none pagespeed-insights_management: all_admins search_console_property: https://karavadra.net/ analytics_dashboard_view: google-analytics-4 analytics_account_id: 3757?? analytics_property_id: none analytics_profile_id: none analytics_use_snippet: no analytics_4_property_id: 2845951?? analytics_4_web_data_stream_id: 2770?????? analytics_4_measurement_id: G-GW???????? analytics_4_use_snippet: yes ### wp_mail_smtp ### version: 3.8.2 license_key_type: lite debug: No debug notices found. lite_install_date: Sep 23, 2021 @ 5:01pm `
Your suggestions are appreciated.
Thank you,
BharatHi, @bharatk! Thank you for sharing that.
What you shared for the code on the editor doesn’t actually have what I would like to review.
Basically, you would need to get the header template part code, not the full page code.
Full Size: https://d.pr/i/VgGV8l@foosantos thank you for showing where the header code was in WordPress 6.3. I’ve copied it below:
<!-- wp:group {"style":{"spacing":{"padding":{"top":"5px","right":"5px","bottom":"5px","left":"5px"}},"border":{"width":"0px","style":"none"},"typography":{"fontSize":"60px"}},"layout":{"type":"default"}} --> <div class="wp-block-group" style="border-style:none;border-width:0px;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;font-size:60px"><!-- wp:navigation {"ref":3755,"customTextColor":"#27ccc0","icon":"menu","hasIcon":false,"layout":{"type":"flex","justifyContent":"center","flexWrap":"nowrap"},"style":{"typography":{"fontStyle":"normal","fontWeight":"600"}}} /--></div> <!-- /wp:group --> <!-- wp:separator {"backgroundColor":"cyan-bluish-gray","className":"is-style-wide"} --> <hr class="wp-block-separator has-text-color has-cyan-bluish-gray-color has-alpha-channel-opacity has-cyan-bluish-gray-background-color has-background is-style-wide"/> <!-- /wp:separator -->
Hi @bharatk, thank you for sharing the code for the header.
Oddly, I see it working as expected from my end with the same code:
Full Size: https://d.pr/i/dIPzg8My guess is that you might have some CSS or custom code changing its behaviour, which is bringing this issue.
My recommendation would be to try creating a brand new header and see if you still can reproduce this. If not, you can try changing the header to the brand-new one.
@foosantos Thanks for your suggestion, I however had the idea of removing the search on the right and the logo on the left. On doing that the menu switches similar to the animated gif in your last message.
It seems that only the width of menu text is considered when determining when it switches to the mobile menu, when it would be better for the whole width of the menu should be considered, no matter elements make up the menu.Hi @bharatk,
I’m glad you found a way that works for you!
It should still work with other items on the menu, so maybe there are something on how these other header items were added:
Full Size: https://d.pr/i/DKDrhwIf you want to add the “native” format, you can try to add this code instead for the header and only edit over it (keeping the same elements):
<!-- wp:group {"layout":{"type":"constrained"}} --> <div class="wp-block-group"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"bottom":"var:preset|spacing|40"}}},"layout":{"type":"flex","justifyContent":"space-between"}} --> <div class="wp-block-group alignwide" style="padding-bottom:var(--wp--preset--spacing--40)"><!-- wp:site-title {"level":0} /--> <!-- wp:navigation {"ref":5,"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"}} /--></div> <!-- /wp:group --></div> <!-- /wp:group -->
Feel free to get back anytime if you need further help. ??
@foosantos the code you provided helped. I re-created the menu and it wraps and switches to the mobile menu a little better.
This theme and block editor take some getting used to.
Even though I probably have to rethink the menu, it’ll stay as it is for now.
Thank you for your help with this. I really appreciate it.
Have a great day,
BharatFantastic! I’m glad to hear it.
Always a pleasure. ??
By the way, I would really appreciate it if you would be open to sharing a review of the theme and your experience here. ??
- The topic ‘How to set full/mobile menu switching & padding’ is closed to new replies.