Support

Account

Home Forums General Issues checkbox fields (probably stupid) question

Solved

checkbox fields (probably stupid) question

  • Hi, I have this issue: I’m using the checkbox fields and so far so good, everything works as expected BUT it’s not exactly as I want. I’ll explain: I have this options:

    red: Red
    blue: Blue

    so far so good, if I select any (or both) of the choices I get the proper output. BUT, what I want is to show an image, not the Red or Blue word. Something like “if ‘blue’ echo ‘blue.jpg'” I can’t figure it out how to do it. Or should teh image code go in the Edit Field admin, kinda

    red: <img src="red.jpg">
    blue: <img src="blue.jpg">

    ?

    btw Elliot, 2 things:
    1) using a different account because the older one didn’t work and couldn’t recover the password because the email wasn’t recognized, even though in my client profile the email is there (f_devin…..)
    2) I want to express my gratitude for this plugin, IMHO the best WP plugin ever, can’t even imagine how isn’t this a default WP plugin or function.

  • Hi @fabio

    Thanks mate,

    To achieve the images, just write some simple if statements like so:

    
    <?php if( in_array( 'red', get_field('field_name') ) ): ?>
    	<img src="red.png" />
    <?php endif; ?>
    
  • thanks you Elliot for your prompt response, it worked like a charm, and this support is just another reason why I love your plugin and recommend it to everybody πŸ™‚

  • I’ve edited this because I’ve found the solution for the problem, and I was doing this completelly wrong. I forgot to check if there where checkboxes active or not.

    Yet I would like that the images also appeared at the backend. How could I do this?

    Thank you once again.
    AMP.

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

The topic ‘checkbox fields (probably stupid) question’ is closed to new replies.