Post No.4
10 November
Manually add menu links to a custom menu location with this snippet. Adjust your menu name as stated within the after_setup_theme registration function.
/** * Snippet Name: Add menu link to custom menu locations * Snippet URL: https://www.wpcustoms.net/snippets/add-menu-link-to-custom-menu-locations/ */ function wpc_new_nav_menu_items($items, $args) { if( $args->theme_location == 'primary_navigation' ){ // update your menu location name here $homelink = '
‘;
$items = $homelink . $items;
}
return $items;
}
add_filter( ‘wp_nav_menu_items’, ‘wpc_new_nav_menu_items’, 10, 2 );