Advertisement
fauzanjeg

Add and Change Position of User Menu 2

Mar 3rd, 2021
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. /* Add and Change Position of User Menu 2 */
  2. add_filter('jnews_dropdown_link', 'jeg_nav_account_menu', 11);
  3.  
  4. function jeg_nav_account_menu($dropdown) {
  5.     if (is_user_logged_in()) {
  6.         $temp = $dropdown;
  7.         unset($dropdown['logout']);
  8.  
  9.         /* Set the position under this code. */
  10.         $dropdown['new_menu'] = array( /* New Menu */
  11.             'text' => 'New Menu',
  12.             'url' => 'http://jnews.io'
  13.         );
  14.  
  15.         $dropdown['new_menu2'] = array( /* New Menu 2 */
  16.             'text' => 'New Menu 2',
  17.             'url' => 'http://jnews.io'
  18.         );
  19.  
  20.         $dropdown['custom_menu_1'] = array( /* New Menu 2 */
  21.             'text' => 'Writing tips',
  22.             'url' => home_url( '/' )
  23.         );
  24.  
  25.         $dropdown['logout'] = $temp['logout']; /* Set Position of logout || Don't delete this initialization, just move the position */
  26.  
  27.         /* Finish adjusting the Position */
  28.  
  29.         return $dropdown;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement