Created
March 22, 2013 08:14
-
-
Save DrewAPicture/5219704 to your computer and use it in GitHub Desktop.
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 characters
<?php | |
// From wp-admin/nav-menus.php | |
break; | |
case 'locations': | |
check_admin_referer( 'save-menu-locations', 'save-menu-locations-nonce', false ); | |
// Get existing menu locations assignments | |
$locations = get_registered_nav_menus(); | |
$menu_locations = get_nav_menu_locations(); | |
// Merge new and existing menu locations if any new ones are set | |
if ( isset( $_POST['menu-locations'] ) ) { | |
$new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); | |
$menu_locations = array_merge( $menu_locations, $new_menu_locations ); | |
// Set menu locations | |
set_theme_mod( 'nav_menu_locations', $menu_locations ); | |
} | |
// TODO: Add a message | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment