Conditional PHP in at WordPress Header

I added,

<div style="margin:0"><a href="#">Sign in</a> | <a href="#">Register</a> | <a href="#">My Account</a> </div>

Read More

at the header of the wordpress website. Now i want to make a function for that. If user stay as logged it then only “My account” will show there with hyperlink and if user not logged in then it will show “Sign in ” and “Register” with hyperlink.

May be wordpress logged in check PHP code is,

<?php if ( !is_user_logged_in() ) ?>

But i am not sure.

Thanks is advance

Related posts

Leave a Reply

2 comments

  1. <?php
    if(!is_user_logged_in()){
    ?>
    <div style="margin:0"><a href="#">Sign in</a> | <a href="#">Register</a>
    <?php }else{ ?>
    <a href="#">My Account</a> </div>
    <?php } ?>