duanpan7011 2017-10-25 10:00
浏览 51

隐藏woo commerce网站首页上的搜索栏,直到转售者登录[关闭]

I have a basic WordPress eCommerce site www.rockitdistribution.com I'd like to hide the search functionality in the header on my website until the user logs in. enter image description here ultimately I just want the unregistered user to see what we hold as a wholesaler but not actually be able to browse product. When a user that we have allocated a user name and password logs in I just want them to be able to see our sites products and so on. So nothing more than an online catelogue if you know what I mean so they can call us to make orders and not do so online. I want all the things I have demarcated in red to be invisible to the general public and only login and logout as well as the search to be visible to logged in users? I hope I am making sense. Please be gentle I am new to this

  • 写回答

2条回答 默认 最新

  • dongxing2015 2017-10-25 10:09
    关注

    Try this!!

    1) For Search Bar you can directly do this check in the header.php if user logged in show the search bar other wise hide it.

    <?php
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    }
    ?>
    

    2) If you wanted to show the products according to logged in customer or visitor you have to create custom template for which ever pages should meet your condition and follow the same pattern showed above (is_user_logged_in).

    评论

报告相同问题?

悬赏问题

  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画