Support

Account

Forum Replies Created

  • Yup, positive, it’s a new variable I’ve created.

    I’ll try the true/false idea next time I use one, see if it resolves the issue.

    I’m baffled by it, but like I say, the var_dump does indeed show the checkbox content as an array.

    Cheers

  • I’m having the same issue. I have an option on a link, a checkbox to say, “Open in new window”. When it’s checked, I use:

    $new = get_field("new_window");

    to return whether this is set or not. If I do:

    if(in_array('set', $new))

    I get an error telling me second variable in in_array must be array

    If I do

    if(strpos($new, 'set') !== false)

    I get an error telling me first variable must be a string. PHP eh?!

    For whatever reason, I can’t do:

    if($new == 'set')

    as this always returns false. A var_dump of the $new variable shows it is indeed an array.

    Any ideas?

    Edited: Actually, I should clarify, these are PHP notices, not errors. I’m not too worried, but I would like to resolve. If the answer is “Because, PHP” well then, that’s it…

  • But isn’t that what get_fields is supposed to do? Is there away I can use get_fields in this manner, to see if any of the content has been populated?

  • Hi Elliot,

    Thanks for taking the time to look at this for me. The output of the var_dump is:

    array(8) { ["title"]=> string(0) "" ["name"]=> string(0) "" ["address"]=> string(0) "" ["email"]=> string(0) "" ["website"]=> string(0) "" ["telephone"]=> string(0) "" ["telephone2"]=> string(0) "" ["telephone3"]=> string(0) "" }

    (Sorry, should have included it with the original question)

    It’s weird. I’m fully convinced I have this functionality working on another project, I just can’t remember which one.

    Cheers,

    T

Viewing 4 posts - 1 through 4 (of 4 total)