Exclude some submenu items when in mobile menu

  • Unknown's avatar

    I am making a child theme of Libre2 and using a local server (MAMP).

    I would like to exclude some submenu items when in mobile (“hamburger”) menu, but don’t know how to do that in Libre2. Any advice?

    Thanks in advance!

  • I believe you’re in the wrong forum. This forum is for questions related to WordPress.COM sites only.

    Your site is a self-hosted WordPress(.ORG) site, for which you can find support here: http://wordpress.org/support/

    For more details on the differences between WordPress.COM and WordPress.ORG, check this page: https://en.support.wordpress.com/com-vs-org/

  • Unknown's avatar

    Thank you Senff for your fast reply!

    Yes, you are right that I’m using self-hosted (.org) platform. However, the theme Libre2, I believe, is yours (Automattic). And I thought that you would have more insight on the template and its behaviour. So, I took my chances to ask on this support forum.

    Despite my platform orientation, I would really appreciate your kind advice on the original issue.

    Many thanks!

  • Unknown's avatar

    Hi there,

    There are many ways to hide menu items only on the mobile view. Perhaps the simplest is with CSS.

    Each menu item is given a unique HTML ID, for example, if you look at the theme demo the “About me” has an ID of #menu-item-337. Using the ID alongside media queries.

    In the case of Libre 2, the mobile menu is displayed until the window has a width of 45em ( around 720px ) then the horizontal menu is displayed. With this information you’ll be able to hide the option on mobile with something like this:

    
    @media screen and (max-width: 45em ) {
      #menu-item-337 {
          display: none;
      }
    }

    You will need to customize the snippet with the IDs of your own menu items.

    As for which forum to post to, for self-hosted version of themes the WordPress.org theme forums is the appropriate place. The Automattic staff monitors the WordPress.org forums supporting the themes we develop. In this case of Libre 2 please ask your questions in the main Libre forum at:
    https://wordpress.org/support/theme/libre/

    Doing so will allow staff and community members to locate and help you out!

  • Unknown's avatar

    Thank you bdukes for your kind reply!

    Yes, your solution works like charm. Thousand thanks!

  • The topic ‘Exclude some submenu items when in mobile menu’ is closed to new replies.