除非登录到我的网站,否则我需要隐藏以下内容。
.imagemapper-wrapper .my_product_price { display:none !important; }
当前它对所有人都是隐藏的。
感谢您的任何帮助!
您执行此操作的一种方法是使用wp_head
钩子。如果用户使用is_user_logged_in()
登录,则可以在挂钩中回显样式。见下文:
<?php
// functions.php
add_action('wp_head', function(){
if (is_user_logged_in()) {
echo '<style>.imagemapper-wrapper .my_product_price { display:none !important; }</style>';
}
});