• Resolved rwolff2005

    (@rwolff2005)


    Hello, I am working on draft for the website. This is regarding navigation menu using the site-editor.php. The navigation menu shows correct format for the menu name and for mobile to be changed into the “hamburger” menu icon.

    I can’t figure out how to convert from name menu into icon as the screen becomes smaller such as when I narrow down the desktop/laptop screen size, or when I am using the tablet. The site-editor.php only gives me the option of having the menu icons be activated at all time, turning it off (having menu names activated at all time), leaving it off at all time (only shows menu icon), or using the menu icon for mobile screen size only.

    Please advise on what I need to do so that I can convert menu name into menu icons.

    Thank you for your time.

    Russ

    • This topic was modified 4 months ago by rwolff2005.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Amjad Ali

    (@amjadr360)

    Hi Russ,

    Thanks for reaching out!

    I think the solution you’re looking for is to change the breakpoint. Right now, the navigation converts to a hamburger menu for mobile screens (which are around 600px wide or smaller). However, it seems you want it to convert to a hamburger menu on larger screens, such as tablets (1024px wide). By default, WordPress does not offer a built-in option to set a custom breakpoint, but we can achieve this using custom CSS.

    Here’s the CSS you can use:

    /* Display mobile menu icon for screens smaller than 1024px */
    @media (max-width: 1024px) {
    .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: flex !important;
    }
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
    display: none !important;
    }
    }

    /* Ensure the desktop menu displays for screens 1024px and above */
    @media (min-width: 1024px) {
    .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: none !important;
    }
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
    display: block !important;
    width: 100%;
    position: relative;
    z-index: auto;
    background-color: inherit;
    }
    }

    You can add this CSS to the Additional CSS field in editor.

    1. Log in to your WordPress Dashboard.

    2. Navigate to Appearance > Customize.

    3. Select the Additional CSS section from the Customizer menu.

    4. Paste the above CSS code into the text area provided.

    5. Click save.

    This will:

    • Convert the menu to a hamburger icon for screens smaller than 1024px (e.g., tablets and smaller devices).
    • Keep the full desktop menu for screens 1024px and wider.

    You can also change the 1024px value to fit your specific needs. If you want the menu to switch at a different width (e.g., 900px or 1200px), feel free to modify the 1024px value in the CSS accordingly.

    After adding this, make sure to clear your browser cache (and any caching plugins if you’re using one) to see the changes applied.

    Thanks,

    Thread Starter rwolff2005

    (@rwolff2005)

    Thank you for your help. Unfortunately, it didn’t work. I spent the entire weekend trying to work around using your code, but it didn’t make any difference. One thing I did manage to do was add CSS (using name I created such as .navMenu to create a border around the menu icon, so I know the issue is in that area. Do you have any suggestions?

    Could you please share your website link so I can check why it’s not working and provide CSS adjustments if any tweaks are needed?

    Thread Starter rwolff2005

    (@rwolff2005)

    This is a draft website I’ve been working on: https://draft4.handsandvoicesny.org/

    I look forward to your suggestions. Thank you!

    Hey,

    I just used the same CSS, but changed the min-width and max-width to 1152, and it seems to be working fine on your website.



    here is what CSS I use.


    /* Display mobile menu icon for screens smaller than 1152px */
    @media (max-width: 1152px) {
    .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: flex !important;
    }
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
    display: none !important;
    }
    }

    /* Ensure the desktop menu displays for screens 1152px and above */
    @media (min-width: 1152px) {
    .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: none !important;
    }
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
    display: block !important;
    width: 100%;
    position: relative;
    z-index: auto;
    background-color: inherit;
    }
    }

    Here are the steps you can follow to retry adding the CSS or troubleshoot:

    1. Ensure CSS is saved: Make sure the CSS is saved properly in the “Additional CSS” section of the Site Editor. After saving, reload the page to see the changes.

    2. Clear cache or hard reload: Clear your browser cache or perform a hard reload to ensure you’re not seeing cached styles.

    3. Check through console log: Use the browser’s developer console to check if the saved CSS is appearing in the browser and confirm it is not being overwritten by other styles.

    Thread Starter rwolff2005

    (@rwolff2005)

    It works perfect!!! Thanks! Really appreciated you assisting me with this one.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.