Merge pull request #69 from johnraz/master

Avoid re-adding page to the main nav each time roots is activated
This commit is contained in:
Ben Word
2011-06-06 19:33:25 -07:00

View File

@@ -65,7 +65,10 @@ if (is_admin() && 'themes.php' === $pagenow && isset( $_GET['activated'])) {
if ($roots_nav_theme_mod) { set_theme_mod('nav_menu_locations', $roots_nav_theme_mod ); }
$primary_nav = wp_get_nav_menu_object('Primary Navigation');
$primary_nav_term_id = (int) $primary_nav->term_id;
$menu_items= wp_get_nav_menu_items($primary_nav_term_id);
if(!$menu_items || empty($menu_items)){
$pages = get_pages();
foreach($pages as $page) {
$item = array(
@@ -76,6 +79,7 @@ if (is_admin() && 'themes.php' === $pagenow && isset( $_GET['activated'])) {
);
wp_update_nav_menu_item($primary_nav_term_id, 0, $item);
}
}
}