Skip to:
Content
Pages
Categories
Search
Top
Bottom

Prevent Fields from Showing in Profile Loop with Conditional Logic?


  • danceshout
    Participant

    @danceshout

    Hi Guys,

    Google and the search function here weren’t helping me, so hopefully this hasn’t been covered here a million time before.

    In the profile loop is it possible to exclude showing one field based on the value of another?

    I’m aware of plugins to change visibility of fields, and I am using one, but in this particular instance I would like an admin to be able to check a radio button when editing a profile to prevent a single field from showing for some users some of the time.

    For an example – I have an extended profile field called “Twitter” – and I’d like to have an extended profile field called “Show Twitter” with options of Yes or No. If the admin selects No, then the Twitter field doesn’t show up on the profile page.

    Hopefully I’ve explained this correctly.

    Is there a way to do this within profile-loop.php?

Viewing 1 replies (of 1 total)

  • Henry Wright
    Moderator

    @henrywright

    You can add a condition inside your template. For example:

    // Get $value here.
    
    // Check if $value is Yes.
    if ( 'Yes' === $value ) {
        // Output
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar