0

I am having 3 custom contents on my front page. Each of them must have an image. However, I want some of them not to have the image, I want to have that field optional.

Any idea where may I change it? I couldn't find any plug in related to that. Only in theme theme folder there is plug in: advanced-custom-fields but I can't find it through wordpress.

The theme is custom, made by another guy so I am not really familiar with that.

enter image description here

I have found this in acf-flexible-content/view directory:

<tr class="required">
<td class="label"><label><?php _e("Required?",'acf'); ?></label></td>
<td>
    <?php 
    do_action('acf/create_field', array(
        'type'  =>  'radio',
        'name'  =>  'fields[' .$fake_name . '][required]',
        'value' =>  $sub_field['required'],
        'choices'   =>  array(
            1   =>  __("Yes",'acf'),
            0   =>  __("No",'acf'),
        ),
        'layout'    =>  'horizontal',
    ));
    ?>
</td>
</tr>

But I guess this is html which is shown upon creation of a field for custom content.

  • ACF can be included within a theme. The theme should contain code that registers the fields, which you can modify to change options, you'll have to search your theme files to figure out where that code is. – Milo Mar 19 '15 at 9:26
  • All right, I have done a little search already but I don't really know what to look for. There is loads of code but all of it seems to be just standard functionality... I will do the search once again. If by any chance you know what should I look for, please let me know :). – Ondrej Tokar Mar 19 '15 at 9:49
  • look for either register_field_group in your theme files, or an acf-json directory inside your theme directory. – Milo Mar 19 '15 at 20:33
  • I have found files : "field-group.js" and "field-group.min.js" I am going to check them out and keep you updated so then you can create an actual answer and I will be able to mark it as correct one. Thank you. :) – Ondrej Tokar Mar 20 '15 at 13:37
  • I found the function register_field_group in plugin-loaders.php file. You were right. Please create an answer. Thanks a lot. – Ondrej Tokar Mar 20 '15 at 14:05
0

Maybe you should copy plugin from theme folder to plugin directory and activate it.

EDIT: I'm sorry. I misunderstand you.

I want to have that field optional

It's needed to change theme php code. The task will be easier if you publish this code.

I guess there is registered save_post hook in the theme code. And this hook checks if image is present. But I can't give fine answer because I don't know what is really written in your theme code.

  • Maybe you want to explain how. Also I'm not sure if that is the best advice. Looking up the specific version and explaining how to fetch exactly that version into the plugins dir might be more beneficial for the OP. – kaiser Mar 19 '15 at 8:33
  • But since that custom content already works, I am assuming that some settings should be somewhere in the WP right? – Ondrej Tokar Mar 19 '15 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.