Reputation: 1852
Just starting today, I started to convert my html site to Wordpress theme, and things seemed well until I got stock with the custom navigation menu.
I tried to convert the following code to wordpress navigation menu but I have no clue how to mix Material Design Lite (external framework) and wordpress.
<div class="mdl-layout__tab-bar mdl-js-ripple-effect mdl-color--primary-dark">
<a href="#overview" class="mdl-layout__tab is-active">Overview</a>
<a href="#features" class="mdl-layout__tab">Features</a>
<a href="#features" class="mdl-layout__tab">Details</a>
<a href="#features" class="mdl-layout__tab">Technology</a>
<a href="#features" class="mdl-layout__tab">FAQ</a>
<button class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored mdl-shadow--4dp mdl-color--accent" id="add">
<i class="material-icons" role="presentation">add</i>
<span class="visuallyhidden">Add</span>
</button>
</div>
I just want to know if it's possible to create the same code above with
<?php wp_nav_menu( $args ); ?>
Should I pass in some parameter ? or should I alter the dashboard ? Since I'm new to wordpress some help would be great ! I would love to hear from you !
Upvotes: 0
Views: 90
Reputation: 8873
Here's how you can do that
<div id="site-navigation" class="mdl-layout__tab-bar mdl-js-ripple-effect mdl-color--primary-dark">
<?php
$menuParameters = array(
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
echo strip_tags( wp_nav_menu( $menuParameters ), '<a>' );
?>
<script type="text/javascript">
$(document).ready(function(){
$('#site-navigation a:first').addClass('mdl-navigation__link is_active');
$('#site-navigation a').addClass('mdl-navigation__link');
});
</script>
</div>
Upvotes: 1