How can I use shortcodes to greet Welcome username on Theme header
-
Hi,
I wanted to use somehow like below in my Header.php file to greet if they are logged in and for loggedout users say Hi Guest![um_loggedin] Welcome, {first_name}[/um_loggedin]
[um_loggedout] Welcome Guest! [/um_loggedout]But none of this short codes seems working. Can you please suggest how to achieve this. For time being, using a very generalized code below:
`<div class=”top-header h2″> <!– Modified, for readability –>
<h1>Samaikya Telugu Vedika</h1>
<h2>?????? ?????????? ????, ???????????? ???????</h2>
<?php
/*if ( is_user_logged_in() ) {
echo ‘Welcome, registered user!’;
} else {
echo ‘Welcome, visitor!’;
}*/
echo ‘<div class=”top-header h2″>’;
if ( is_user_logged_in() ) {echo ‘<h2>Welcome, registered user!</h2>’;
//echo $_SESSION[‘username’];
//[um_loggedin] Welcome back {first_name} [/um_loggedin]
} else {
echo ‘<h2>Welcome Guest!</h2>’;
}
echo ‘</div>’;
?>
</div>`
- The topic ‘How can I use shortcodes to greet Welcome username on Theme header’ is closed to new replies.