-
-
Save edbentinck/1b7af83d7f76e6adfb76 to your computer and use it in GitHub Desktop.
Revisions
-
edbentinck renamed this gist
May 7, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
edbentinck revised this gist
May 7, 2014 . No changes.There are no files selected for viewing
-
edbentinck revised this gist
May 7, 2014 . No changes.There are no files selected for viewing
-
edbentinck revised this gist
May 7, 2014 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ <?php $menu_name = 'primary'; $locations = get_nav_menu_locations(); $menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); $menuitems = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) ); ?> <nav> <ul class="nav site-nav l-container l--fullwidth"> <?php $count = 0; $submenu = false; @@ -16,7 +16,9 @@ $id = get_post_meta( $item->ID, '_menu_item_object_id', true ); // set up a page object to retrieve page data $page = get_page( $id ); $title = $item->title; $link = $item->url; // item does not have a parent so menu_item_parent equals 0 (false) if ( !$item->menu_item_parent ): @@ -25,12 +27,12 @@ $parent_id = $item->ID; ?> <li class="site-nav__item"> <a href="<?php echo $link; ?>" class="title"> <?php echo $title; ?> </a> <a href="<?php echo $link; ?>" class="desc"> <?php echo $item->post_excerpt; ?> </a> <?php endif; ?> @@ -41,8 +43,8 @@ <?php endif; ?> <li class="item"> <a href="<?php echo $link; ?>" class="title"><?php echo $itle; ?></a> <a href="<?php echo $link; ?>" class="desc"><?php echo $item->post_excerpt; ?></a> </li> <?php if ( $menuitems[ $count + 1 ]->menu_item_parent != $parent_id && $submenu ): ?> -
hitautodestruct revised this gist
Mar 28, 2013 . No changes.There are no files selected for viewing
-
hitautodestruct revised this gist
Dec 20, 2012 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,4 +55,7 @@ </li> <?php $submenu = false; endif; ?> <?php $count++; endforeach; ?> </ul> </nav> -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ <?php $menu_name = 'main_nav'; $locations = get_nav_menu_locations(); $menu = wp_get_nav_menu_object( $locations[ $menu_name ] ); $menuitems = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) ); ?> <nav> <ul class="main-nav"> <?php $count = 0; $submenu = false; foreach( $menuitems as $item ): // get page id from using menu item object id $id = get_post_meta( $item->ID, '_menu_item_object_id', true ); // set up a page object to retrieve page data $page = get_page( $id ); $link = get_page_link( $id ); // item does not have a parent so menu_item_parent equals 0 (false) if ( !$item->menu_item_parent ): // save this id for later comparison with sub-menu items $parent_id = $item->ID; ?> <li class="item"> <a href="<?php echo $link; ?>" class="title"> <?php echo $page->post_title; ?> </a> <a href="<?php echo $link; ?>" class="desc"> <?php echo $page->post_excerpt; ?> </a> <?php endif; ?> <?php if ( $parent_id == $item->menu_item_parent ): ?> <?php if ( !$submenu ): $submenu = true; ?> <ul class="sub-menu"> <?php endif; ?> <li class="item"> <a href="<?php echo $link; ?>" class="title"><?php echo $page->post_title; ?></a> <a href="<?php echo $link; ?>" class="desc"><?php echo $page->post_excerpt; ?></a> </li> <?php if ( $menuitems[ $count + 1 ]->menu_item_parent != $parent_id && $submenu ): ?> </ul> <?php $submenu = false; endif; ?> <?php endif; ?> <?php if ( $menuitems[ $count + 1 ]->menu_item_parent != $parent_id ): ?> </li> <?php $submenu = false; endif; ?> <?php $count++; endforeach; ?>