How to add a Custom Menu in Top Menu in WordPress

Add below lines in functions.php to add a dynamic menu or a custom menu in wordpress. add_filter( ‘wp_nav_menu_items’, ‘loginout_menu_item’, 10, 2 ); function loginout_menu_item ( $items, $args ) { if ($args->theme_location == ‘top’) { if ( is_user_logged_in() ) $items .= ‘<li><a href=”‘ . wp_logout_url( home_url() ) . ‘” data-level=”1″><span>Logout</span></a></li>'; else $items .= ‘<li><a href=”‘ .…

Details