Last active
August 29, 2015 14:27
-
-
Save Sam152/3d51d51d78cdf07d4033 to your computer and use it in GitHub Desktop.
Replicate Snippet for fleshing out brochure website menus
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 | |
$main_menu_links = menu_load_links('main-menu'); | |
foreach ($main_menu_links as $menu_item) { | |
if ($menu_item['link_path'] == 'node/1' && $menu_item['link_title'] !== 'Home') { | |
$new_node = node_load(replicate_entity_by_id('node', 1)); | |
$new_node->title = $menu_item['link_title']; | |
$menu_item['link_path'] = 'node/' . $new_node->nid; | |
menu_link_save($menu_item); | |
node_save($new_node); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment