Created
December 26, 2015 19:07
-
-
Save galengidman/d9b4a27ed08fb68a4a6a to your computer and use it in GitHub Desktop.
Convert wp_page_menu() to wp_nav_menu() markup
This file contains 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 characters
<?php | |
$html = wp_page_menu( array( | |
'echo' => false, | |
'depth' => 2 | |
) ); | |
$html = str_replace( ' page_item_has_children', ' menu-item-has-children', $html ); | |
$html = str_replace( ' current_page_item', ' current-menu-item', $html ); | |
$html = str_replace( ' page-item-', ' menu-item-', $html ); | |
$html = str_replace( 'class="page_item', 'class="menu-item', $html ); | |
$html = str_replace( "class='children'", 'class="sub-menu"', $html ); | |
return $html; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment