Support » Plugin: Content Visibility for Divi Builder » Boolean code required please

  • Resolved wittser

    (@wittser)


    Hi there

    I have spent a whole evening trying to find the code required to generate the right boolean code to query if a custom field in my WordPress Divi site has a value, in the Content Visibility section, if it does then to display the social media button, if not to not display the button.

    The field name is jv_team_instagram (and same for Twitter and Facebook) but I just cant create the correct code to achieve:

    If jv_team_instagram is not null then set as true

    Any help with this would be so appreciated as I have tried so many variations without any success?

    Many many thanks in advance
    Dave

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jonathan Horowitz

    (@jhorowitz)

    Hi @wittser,

    Try this to show if the field is set:
    in_array( 'jv_team_instagram', get_post_custom_keys() ).

    That will test for the presence of the key regardless of value. To not show, that field would need to be deleted/not present at all.

    Thread Starter wittser

    (@wittser)

    Hi Jonathan

    Thank you so much and I have tried this and the field is set and displays.

    How do we achieve the validation so that the value of this field can be interrogated, i.e.

    Field has a value – return a boolean 1/true
    or
    Field has NO value – return a boolean 0/false

    Many thanks in advance
    Dave

    Plugin Author Jonathan Horowitz

    (@jhorowitz)

    Hi @wittser,

    Try get_post_meta( get_the_ID(), 'jv_team_instagram', true ) !== ''. πŸ™‚

    Thread Starter wittser

    (@wittser)

    That is brilliant, thank you so very very much. That has made an old man very very happy.

    If you check out http://www.wadebridgetownfc.co.uk/teams/1st-team/#squad you can see it in action by clicking on any of the profiles.

    BTW – whilst there you can see (or not) the “read more” link text is red on a red background. How do I change the link text colour for the ‘read more’ element please so it displays effectively?

    Many many thanks
    Dave πŸ™‚

    Plugin Author Jonathan Horowitz

    (@jhorowitz)

    @wittser glad it worked for you!

    In the Divi frontend builder, at the bottom of the page will be a circle with three dots. Click it, and then click the Cog icon (settings) to open up the page settings modal. On the advanced tab, there will be a Custom CSS section. You can add this to change the links within those boxes:

    
    .et_pb_jv_team_content a {
      color: #edf000;
    }
    

    It looks like that is a custom element in the Divi builder; the author should probably add a customization setting for link styles if it isn’t already there πŸ™‚

    HTH!

    Thread Starter wittser

    (@wittser)

    Thank you so much. You have me cooking on gas now. Complete star and great support πŸ™‚

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Boolean code required please’ is closed to new replies.