Title: Materialize css framework and dropdown menu problem.
Last modified: September 6, 2016

---

# Materialize css framework and dropdown menu problem.

 *  [pumanitro](https://wordpress.org/support/users/pumanitro/)
 * (@pumanitro)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/materialize-css-framework-and-dropdown-menu-problem/)
 * Hello!
 * Im using Materialize Css framework to create Material Design theme.
    I have problem
   with making dropdown menu available onto WordPress.
 * First of all I need to have submenu structure which have special **Id** and **
   class=”dropdown-content”** (ul -> li -> a structure). ([There it is](http://materializecss.com/navbar.html))
 * Second one is to have :
    – class=”dropdown-button” – href=”#!” – data-activates
   =”dropdown1″ in link tag (a).
 * After clicking of that menu I just want to see sub menu.
 * In my function.php i added this :
 *     ```
       function add_menu_atts( $atts, $item, $args ) {
           if (in_array('menu-item-has-children', $item->classes)) {
               $atts['class'] = "dropdown-button";
               $atts['href'] = "#!";
               $atts['data-activates'] = 'dropdown1';
           }
           return $atts;
       }
       add_filter( 'nav_menu_link_attributes', 'add_menu_atts', 10, 3 );
       ```
   
 * To add class, link, and data-activates atributes to link which have children/
   s.
    And second part of code is :
 *     ```
       function start_lvl( &$output, $depth = 0, $args = array() ){
               $indent = str_repeat("\t", $depth);
               $output .= "\n$indent<ul id=\"dropdown2\" class=\"sub-menu dropdown-content\">\n";
           }
       ```
   
 * I use it to add id of all ul childrens. (For now im just trying only one submenu)
   
   There is my menu : [https://scr.hu/2G4W19](https://scr.hu/2G4W19)
 * Ass you can see here: [https://scr.hu/BWPkNP](https://scr.hu/BWPkNP) I have it
   all done but I need to have the same ID on the “ul” like on “a” data-activates.
   
   But when I change one of this 2 parts of code for the same all sub menu structure
   disapear. And in code it look like : [https://scr.hu/nM2wJM](https://scr.hu/nM2wJM)
 * Please help!

Viewing 1 replies (of 1 total)

 *  Thread Starter [pumanitro](https://wordpress.org/support/users/pumanitro/)
 * (@pumanitro)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/materialize-css-framework-and-dropdown-menu-problem/#post-8158201)
 * 🙁 refresh ?

Viewing 1 replies (of 1 total)

The topic ‘Materialize css framework and dropdown menu problem.’ is closed to new
replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [pumanitro](https://wordpress.org/support/users/pumanitro/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/materialize-css-framework-and-dropdown-menu-problem/#post-8158201)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
