Limit Frontpage Menu items and/of limit to subsection only

Home Forums Auberge Limit Frontpage Menu items and/of limit to subsection only

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20879

    helen
    Participant

    Limit Frontpage Menu items and/of limit to subsection only

    Resolved

    Hey there! Have you noticed this support service is provided FREE of charge?
    If you like the speed and accuracy of resolutions, please consider supporting me with a small donation. Thank you

    Consider a donation →

    Hi there,
    I having been really busy with the this wonderful Auberge theme. I have run into a issue.
    I have correctly added submenus to my menu’s. However I would like to limit the amount of menu items shown on the front page.

    Is it possible to limit the frontpage to a specific submenu but keep all the menu buttons on the frontpage?
    And or is it possible to limit the amount of menu items on each submenu?

    Because I still have 60% of the menu too add the menu is going to be way too long. Hop you can help.

    #20883

    Oliver Juhas
    Keymaster

    Hi helen,

    Please note that I can not access your website as it is in “coming soon” mode.

    If I understand correctly, you would like to restrict the food menu display on homepage to certain specific items or food menu sections, correct?

    You can try to do this via a wmhook_loop_food_menu_query filter hook in your child theme‘s functions.php file:

    function child_theme_loop_food_menu_query( $query ) {
      if ( is_front_page() ) {
        // Adapt the query to your needs, such as:
        $query['posts_per_page'] = 50;
      }
      return $query;
    }
    add_filter( 'wmhook_loop_food_menu_query', 'child_theme_loop_food_menu_query' );

    However, Jetpack plugin really messes with food menu query and it might not work as expected for you. In that case you might need to dig deeper to how Jetpack plugin displays the query.

    Or, try using faster and simpler solution using custom CSS:

    .home .menu-items .entry {
    	display: none;
    }
    
    /**
     * This code displays only 4 food menu items in each section on homepage.
     * But why there is the number "5" in the code?
     * The first item in the food menu section is the section header, its title.
     * That's why we need to skip it, so if we want to display 4 food menu items,
     * we need to add the food section header to it too: 4+1=5.
     * If we want 6 items, we need to replace "5" in the code with 7, and so on...
     */
    .home .menu-items .entry:nth-child(-n+5) {
    	display: block;
    }

    Best regards,

    Oliver Juhas
    WebMan Design

    #20900

    helen
    Participant

    This is a private reply!

    This reply has been marked as private.
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.