1

How do you hide sub menus (drop down) for a specific menu. For instance I have 3 menus; Soccer, Basketball, and Football. When I hover on the soccer menu, I see articles named Messi, Ronaldo and Neymar drop down. I hover on the Basketball menu, I see Lebron, Durant, and Kobe. When i hover over the football menu, i see RG3, Wilson, and Manning. I want to get it such that when I hover on the soccer menu, I can't see any of the articles in a drop down menu. I want to get it just for the soccer menu, but the others should still have drop down menus when hovered on.

user3078335
  • 781
  • 4
  • 13
  • 24
  • do you mean, not drop down menus for soccer main menu, but when you click on it, it should display all the articles related to soccer? – Yichz Apr 10 '15 at 20:32
  • No, i don't want to see a drop down menu when hovered on. Is there a way to hide it? I don't wanna unpublish the articles as well. – user3078335 Apr 10 '15 at 20:38
  • you should change all your articles related to Messi, ronaldo and neymar to the top menu's category, then, delete or unpublish those child menus(Messi, ronaldo and neymar). – Yichz Apr 10 '15 at 20:42

2 Answers2

2

If you are using mod_menu module, you have to create a template override to templates/your_template/html/mod_menu/default.php and add this code at the beginning of: foreach ($list as $i => &$item) { ... }

$parent_id = 779;
if($item->id == $parent_id) { $item->deeper = null; }
$this_parent = $item->parent_id;
while ($this_parent != 1) {
    if($this_parent == $parent_id) continue 2;
    foreach ($list as $parent_search) {
        if($parent_search->id == $this_parent) {
            $this_parent = $parent_search->parent_id;
        }
    }
}

So it will check if parent has the specified id and skip all children. You could also extend it using in_array() for multiple ids.

Reference: in_array()

emmanuel
  • 9,607
  • 10
  • 25
  • 38
0

You can do this in the Module Manager for that specific menu. There is a drop down for "Start Level" and "End Level". Just set them both to "1" and only the top level items will be displayed.

BradM
  • 646
  • 8
  • 18