Create Menu on Theme Activation – WordPress

add_action(‘after_switch_theme’, ‘theme_activation_function’, 10 ,  2); function theme_activation_function ($oldname, $oldtheme = false) { /* Create header and footer menus */   $menus = array(     ‘Primary Menu’  => array(       ‘about-us’  => ‘About Us’,        ‘services’  => ‘Services’,        ‘templates-forms’  => ‘Templates & Forms’,        ‘clients’  => ‘Clients’,        ‘price-quote’  => ‘Price Quote’     ),   ‘Top Menu’ => array(     ‘home’ => ‘Home’,      ‘contact’ => ‘Contact’,      ‘sitemap’ => ‘Sitemap’   ),   ‘Footer Menu’ => array(     ‘terms-of-use’ => ‘Terms of Use’,      ‘privacy-policy’ => ‘Privacy Policy’   ) ); foreach($menus as $menuname => $menuitems) {   $menu_exists = wp_get_nav_menu_object($menuname);   // If it doesn’t exist, let’s create it.   if ( !$menu_exists) {     $menu_id = wp_create_nav_menu($menuname);     foreach($menuitems as $slug => $item) {       wp_update_nav_menu_item(       $menu_id, 0, array(             ‘menu-item-title’  => $item,             ‘menu-item-object’  => ‘page’,        … Continue reading Create Menu on Theme Activation – WordPress

Customize the order of the admin menu

This code will allow you to reorganize the order of elements in the admin menu. All that you need to do is click on an existing link in the admin menu and copy everything before the /wp-admin/ URL. The order below represents the order the new admin menu will have. // CUSTOMIZE ADMIN MENU ORDER… Continue reading Customize the order of the admin menu