Support

Account

Home Forums Feature Requests Checkbox > Colors

Solving

Checkbox > Colors

  • Hi, Im trying to find some way to make the checkboxes that I have created and “translate” them in to colors (images maybe). I think it has to be done in the .php files but I I don’t know wich one, maybe with default value ??
    If someone could help me it would be great!

    If there’s another topic/post like this I’m sorry, I haven’t found anything like this.

    Thanks!

    • Elliot

    • October 23, 2013 at 5:43 pm

    Hi @berniinfante

    I’m a bit confused about your question.

    What do you mean by “translate” the colors?
    Where visually would this happen in your website, and what would it look like?

    Why do you suspect the default value file? I don’t know what file this is.

  • For eg. I created red green and black and I want that in the website you see the color not the word, i think that this may be done with images. But I don’t know how to do it.

    Thanks!

    • Elliot

    • October 24, 2013 at 3:44 pm

    Hi @berniinfante

    maybe something like this:

    
    <div style="color: <?php the_field('color'); ?>">
    <p>I will take on the color chosen!</p>
    </div>
    

    This example should be clear enough. Please consult google for more CSS / color code

    Thanks
    E

  • I couldn’t make it work.
    I tried everything, but most of the times my “color section” disapeard.

    I have to make this work.. i there any other way with ACF to creat the color section of a product?

    Thanks

    • Elliot

    • October 28, 2013 at 4:20 pm

    Hi @berniinfante

    I don’t understand what you are asking.

    Perhaps you could provide the code you are using?
    Can you be specific as to what is and isn’t working?

    Have you done any debugging?
    Can you confirm he data is saved?
    Can you confirm the global $post is correct when you use the get_field function?

  • in the post.php;
    <h2>Available Colors</h2>
    <p><?php the_field(‘colors’); ?></p>

    I have tried:
    1. in the default value box in the edit Custom Fields
    <div style=”color: <?php the_field(‘color’); ?>”>
    <p>I will take on the color chosen!</p>
    </div>
    2. in the meta_box_options.php
    <?php
    do_action(‘acf/create_field’, array(
    ‘type’ => ‘checkbox’,
    ‘name’ => ‘white[hide_on_screen]’,
    ‘value’ => $white[‘hide_on_screen’],
    ‘choices’ => array(
    ‘the_content’ => __(“<?php ?>”,’acf’),
    ‘excerpt’ => __(“Excerpt”),
    ‘custom_fields’ => __(“Custom Fields”),
    … )
    ));
    ?>

    Nothing works, I don’t know where to put the code.

    • Elliot

    • October 29, 2013 at 5:48 pm

    Hi @berniinfante

    What is this (I don’t understand why you have pasted this code):

    
    <?php
    do_action(‘acf/create_field’, array(
    ‘type’ => ‘checkbox’,
    ‘name’ => ‘white[hide_on_screen]‘,
    ‘value’ => $white['hide_on_screen'],
    ‘choices’ => array(
    ‘the_content’ => __(“<?php ?>”,’acf’),
    ‘excerpt’ => __(“Excerpt”),
    ‘custom_fields’ => __(“Custom Fields”),
    … )
    ));
    ?>
    

    As for you original question. Have you checked the page source (html) to actually see what is rendered. You may find that all you need to do is add a ‘#’ before the value for it to be a correct CSS color?

  • Hi, sorry but I don’t know what HTML page source you are refering to. If you could point out the root it would be grat. Thanks

    • Elliot

    • November 4, 2013 at 4:14 pm

    Hi @berniinfante

    I’m not quite sure if you understand how to use this plugin with a theme.
    Have you read the docs article which covers the basics for ACF?

    What code are you using in your theme to render this color?

  • Hi! I haven’t been able to render any color, I have tried everything ( but i’m guessing that I haven’t been doing it right) the thing is that I have tried to make it work in the php with in the plugin, and my theme, I have even tried to do it with images so I wouldn’t mess up in the code of the color.
    When you wrote the first code I tried to change the color on the field group editing; I have read all the documentation available, and I can’t solve this.. 🙁

    • Elliot

    • November 4, 2013 at 4:50 pm

    Hi @berniinfante

    Your reply still shows no code snippet. I can’t help you if you are not able to provide the code which you are using to render the color.

    What code are you using?
    Where are you using this code?

    Thanks
    E

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.