我想运行 jquery,以便在用户未登录时不显示 wordpress 小部件栏按钮,而是重定向到注册页面。
在此先感谢,我对此有点困惑,我已经设法通过 css 更改按钮的图像,具体取决于它是否已登录,但我不能使用 jquery
最佳答案
对于任何你想只为登录用户显示的元素,你可以这样做:
<?php if ( is_user_logged_in() ) { ?>
<!-- content --> //Add here the block of code that displays the widget bar button
<?php } ?>
附言我认为您要完成的任务最好用 php 而不是 jquery 来完成。
关于php - 用户未登录时 JQuery btn-widgetbar 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46035803/