• Resolved pinokio

    (@lapanwebsite)


    <?php if ( is_user_logged_in() ) { '<a class="btn" href="/author/<?php global $current_user;
    get_currentuserinfo();
    echo $current_user->display_name;
    ?>">Channel</a>'; } else { echo 'Welcome, visitor!'; } ?>

    Anyone knows how to fix this function I wanna put in header?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I don’t get what you are trying to link to. But the below code should work to display a link if the user is logged in.

    <?php
    if ( is_user_logged_in() ) {
        echo "<a class='btn' href='/wp-admin/profile.php'>Channel</a>";
    } else {
        echo 'Welcome, visitor!';
    }
    ?>
    Thread Starter pinokio

    (@lapanwebsite)

    					<?php if ( is_user_logged_in() ) {
        $current_user = wp_get_current_user();
        echo '<div class="chany"><a class="btns" href="/author/' . 
            $current_user->display_name . 
            '">Channel</a><a class="btns" href="/add-video">Add Video</a></div>'; } else { echo '<div class="chany_log"><a class="btns" href="/login-register">Login / Register</a></div>'; } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding link for logged in user?’ is closed to new replies.