0

On wordpress, I want to hide custom field values only with a button called "For registered members" with a specific hyperlink called "/membership".

Here's the demo listing link: https://main.mylistingtheme.com/listing/bmw-316-d-facelift/

And here's the sample image (what I want): https://prnt.sc/zg40yh

Can you please share the code for me just for one custom field which I can use in the child theme's functions.php file?

Thanks

1 Answer 1

0

If the registered users are all within the WP user table then you can do something like this

<?php 
 if( is_user_logged_in() ) { 
  /// link to membership section
 } else {
  /// link to signup page?
 }
?>

This will check the current status of the user and see if they are logged in or not.

More info: https://developer.wordpress.org/reference/functions/is_user_logged_in/

2
  • I want to hide the value of the custom fields as per choice. Can you show me any sample code? I want exactly as this picture: prnt.sc/zg40yh
    – Teope
    Commented Feb 14, 2021 at 13:16
  • Currently, all custom field values are visible. I want a code that will make the custom fields look like as this link: prnt.sc/zg40yh
    – Teope
    Commented Feb 14, 2021 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.