问题描述
我的页面底部有一个部分,其中包含从不同页面导航成员(已登录)的图标.它由个人资料"、潜在客户"、订单"和过滤器"组成.
I have a section at the bottom of my page with icons that navigates members (logged-in) from different pages. It consists of 'profile', 'leads', 'orders' and 'filter'.
我希望未登录的用户(客户)不要看到此导航部分,因为客户可以查看会员个人资料并且不希望他们进入这些页面.
I wish for non-logged-in users (customers) not to see this navigation section as the the customers can check a members profile and do not want them entering those pages.
有没有办法对未登录的用户隐藏此部分?
Is there a way to hide this section to non-logged in users?
我想隐藏的部分的类叫做'icon-container'
The section's class I want to hide is called 'icon-container'
推荐答案
您可以使用 is_user_logged_in()
检查当前访问者是否为登录用户.
You can use is_user_logged_in()
to check if whether the current visitor is a logged in user.
所以,在php文件中,你可以这样做:
So, in the php file, you can do it like this:
<?php if (is_user_logged_in()): ?>
<section>
</section>
<?php endif; ?>
因此, 只会在用户登录时呈现.
Thus, the <section>
will only be rendered if the user is logged in.
这篇关于如何隐藏已注销用户的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!