Advertisement
marstheme

Untitled

Apr 22nd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. if( ! function_exists( 'videotube_add_login_profile_menu_item' ) ){
  2.     /**
  3.      * @param html $items
  4.      * @param array $args
  5.      */
  6.     function videotube_add_login_profile_menu_item( $items, $args ) {
  7.        
  8.         if( $args->theme_location != 'header_main_navigation' ){
  9.             return $items;
  10.         }
  11.        
  12.         // The custom login page url goes here
  13.         $login_url = '';
  14.        
  15.         // The custom profile page url goes here
  16.         // In your case, it's http://jukeboxculture.com/index.php/profile/
  17.         $profile_url = '';
  18.        
  19.         if( ! is_user_logged_in() ){
  20.             $items .= '<li class="login">
  21.                 <a href="'. esc_url( $login_url ) .'">'. esc_html__( 'Login', 'mars' ) .'</a>
  22.             </li>';
  23.         }
  24.         else{
  25.             $items .= '<li class="profile">
  26.                 <a href="'. esc_url( $profile_url ) .'">'. esc_html__( 'Profile', 'mars' ) .'</a>
  27.             </li>';
  28.         }
  29.        
  30.         return $items;
  31.        
  32.     }
  33.     add_filter( 'wp_nav_menu_items','videotube_add_login_profile_menu_item', 10, 2 );
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement