WPMU DEV Automated Navigation Menus
wpmu_list_pages() {
$args = array(
'depth' => 2
);
wp_list_pages( $args );
}
wp_list_pages( $args );
wpmu_list_pages() {
$args = array(
'depth' => 2
);
}
<?php wp_nav_menu( array(
'theme_location' => 'top',
'menu_id' => 'top-menu',
) ); ?>
/*
Theme Name: WPMU DEV Automated Navigation Menus
Theme URI: https://github.com/rachelmccollin/wpmudev-automated-menus
Description: Theme to support WPMU DEV post on automating navigation and section menus. Child theme for the Twenty Seventeen theme.
Author: Rachel McCollin
Author URI: http://rachelmccollin.co.uk/
Template: twentyseventeen
Version: 1.0
*/
@import url("../twentyseventeen/style.css");
<?php
/**
* Plugin Name: WPMU DEV Automated Navigation Menus
* Plugin URI: https://github.com/rachelmccollin/wpmudev-automated-menus
* Description: Plugin to accompnay WPMU DEV post on automating navigation and section menus
* Version: 1.0
* Author: Rachel McCollin
* Author URI: http://rachelmccollin.co.uk
*
*/
<?php
if ( function_exists( 'wpmu_list_pages' ) ) {
wpmu_list_pages();
}
else {
wp_nav_menu( array(
'theme_location' => 'top',
'menu_id' => 'top-menu',
) );
}
?>
$args = array(
'depth' => 2,
'title_li' => '<h3>' . __( 'Menu', 'wpmu' ) . '</h3>',
'sort_column' => 'menu-order'
);
$args = array(
'depth' => 2
);