[themify_is_logged_in]
[php]
function add_loginout_link( $items, $args ) {
if ( is_user_logged_in() ) { // deleting && $args->theme_location == ‚primary‘ works
$user = get_current_user_id();
$user_profile_id = get_user_meta( $user, ‚CPT_ID‘, true );
$url = get_edit_post_link( $user_profile_id );
$items .= ‚<li><a href="‘. $url .’">EDIT</a></li>‘;
$items .= ‚<li><a href="‘. wp_logout_url() .’">LOGOUT</a></li>‘;
}
elseif ( !is_user_logged_in() ) { // deleting && $args->theme_location == ‚primary‘ works
$items .= ‚<li><a href="‘. site_url( ‚wp-login.php‘ ) .’">LOGIN</a></li>‘;
$items .= ‚<li><a href="‘. site_url( ‚/registrieren/‘ ) .’">REGISTER</a></li>‘;
}
return $items;
}
add_filter( ‚wp_nav_menu_mainmenu_items‘, ‚add_loginout_link‘, 10, 2 ); // mainmenu is the name of the navigation i need to trigger
[/php]
[/themify_is_logged_in]