Comments (3)
Material Design Lite doesn't have styling for submenus.
from mdlwp.
Yes i know although one way to add submenu to this theme which is needed and there is an option on wordpress is like this.
<nav respond-plugin type="menu" menu="primary" class="mdl-navigation mdl-layout--large-screen-only">
<li id="home" class="mdl-navigation__link" >Link 1</li>
<a class="mdl-navigation__link" href="page/news.html">Link 2</a>
<a class="mdl-navigation__link" href="#">Link 3</a>
<!-- sub menu only visible when clicked on the link above -->
<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect"
for="home">
<a class="mdl-menu__item" href="index.html">SubLink 1</a>
<a class="mdl-menu__item" href="index.html">SubLink 2</a>
</ul>
........
The question is how to edit the Custom nav_walker to make support this?
from mdlwp.
Anyway i did some changes in your nav_walker class and hope that now it should work like a charm. I will make a pull request soon.
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
global $previous;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
if ( in_array( 'current-menu-item', $classes ) )
$class_names .= ' is-active';
$class_names = $class_names ? ' class="mdl-navigation__link ' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ($item->menu_item_parent)? (! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''): '';
$attributes .= ! empty( $item->ID ) ? ' id="' . esc_attr( $item->ID ) .'"' : '';
if ($item->menu_item_parent){
$attributes .= 'class="mdl-menu__item"';
}else{
$attributes .= $class_names;
}
$item_output = $args->before;
if (!$item->menu_item_parent && $previous->menu_item_parent){
$item_output .= '</ul>';
}
if ($item->menu_item_parent && !$previous->menu_item_parent){
$item_output .= '<ul class="mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="'. $item->menu_item_parent.'">';
}
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
$previous = $item;
}
from mdlwp.
Related Issues (20)
- Use different colors HOT 1
- Problem on mobile devices HOT 2
- WARN deprecated [email protected] HOT 1
- Problem in the menu of the demo. HOT 1
- Search bar HOT 1
- Icons in drawer menรน
- No option to add/change header image HOT 2
- blue gray color not working HOT 1
- MDLWP Portfolio HOT 3
- Not working correctly with the portfolio plugin HOT 1
- masonry view broken HOT 1
- Theme broken: Invalid argument provided to upgrade MDL element HOT 1
- Disqus not working HOT 5
- Material Design Portfolio HOT 12
- Registry returning 404 HOT 3
- Trouble with jetpack infine scroll HOT 1
- Sticky footers don't work in this theme HOT 2
- Material Design Portfolio plugin HOT 2
- JetPack Cookies Banner Widget
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdlwp.