Suppress view of label if user logged out
-
Hi, I am going crazy with this problem so I hope somebody can help.
https://wattev2buy.com/product/best-ev-in-china/
There are three meta fields in woo commerce that I don’t want to show to logged out users. The source of the metadata, however, is from WP Front End Pro and they advised the following
https://docs.wedevs.com/docs/wp-user-frontend-pro/tutorials/showing-meta-fields-in-frontend/
My poor effort is:
<div class=”<?php if ( is_user_logged_in() ) echo “logged-in”; else echo “not-logged-in”; ?>”>
<?php echo get_post_meta( $post->ID, ‘_email’, true ); ?>
<?php echo get_post_meta( $post->ID, ‘_regular_price’, true ); ?>And then in style css
.not-logged-in .get_post_meta( $post->ID, _email ) {
display: none;
}
.not-logged-in .get_post_meta( $post->ID,_regular_price ) {
display: none;
}And then there is a field I don’t want to show to logged in or out users – the _gallery_images at bottom.
- The topic ‘Suppress view of label if user logged out’ is closed to new replies.