Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter grasycho

    (@grasycho)

    Ok, found my own answer;

    function add_menu_parent_class( $items,$args ) {
    
    		if( is_admin() ||  $args->theme_location != 'author-menu' )
    		return $items;
    
    		$redirect = ( is_home() ) ? false : get_permalink();
    
    		if (is_user_logged_in() &&  $args->theme_location == 'author-menu')
    		{
    
    			$userdata =  wp_get_current_user();
    
    			$link = wp_logout_url( $redirect );
    
    			$link_profile = array (
    				'title'            => 'Logout',
    				'menu_item_parent' => 7618,
    				'ID'               => '234234234234234',
    				'db_id'            => '234234234234234',
    				'url'              => $link,
    			);
    
    			$items[] = (object) $link_profile;
    		}
    		else
    		{
    
    				$link = 'https://gfxbuy.com/sign-in';
    				$link_logout = array (
    
    				'title'            => 'Login',
    				'menu_item_parent' => 7618,
    				'ID'               => '5746734534',
    				'db_id'            => '5746734534',
    				'url'              => $link,
    			);
    			$items[] = (object) $link_logout;
    		}
    	return $items;
    }
    add_filter( 'wp_nav_menu_objects', 'add_menu_parent_class',10,2 );
Viewing 1 replies (of 1 total)