I have the following code when the user is logged out:
<div >
<div >
<?php avada_main_menu(); ?>
<?php avada_mobile_menu_search(); ?>
<ul id="odp-main-menu-right" >
<li >
<a href=""><i >
</i>0</a>
</li>
<li id="upload-ad" >
<a href="<?php echo wp_login_url(trailingslashit(home_url($wp->request)));?>"
style="color: #fff;">
NEW ADVERT
</a>
</li>
</ul>
</div>
However when the user is logged out it must hide the following and when logged in show the following on the front-end:
<li >
<a href=""><i >
</i>0</a>
</li>
I've used a CSS class to add display:none
on a class not-logged-in but when logged in, but it is still gone.
When logged in, the wp_login_url must also be replaced by a clickable ID element
CodePudding user response:
You can use this.
<?php if(is_user_logged_in()){ ?>
//Your HTML here needs to be shown when the user is logged in.
<?php } ?>