Hi @ahenriksen, no unfortunately not. The method suggested just embedded a front end version of the form which on the face of it looked okay but it didn’t actually save any of the data when updating the product. It wasn’t essential but it would have been nice for the end user so it was a bit tidier.
Hi Vverner,
I’ve given it a try but it embeds the form onto the product data tab rather than integrating with it (you can’t update these fields unless you use the update button provided at the bottom of the tab). I wasn’t sure if there was any documentation or an example for something similar that I can use a basis?
Pleased to hear that you managed to sort it 🙂
Can you take a screenshot of the field set up for me please?
Just to check, what have you called the field and is it inside the loop?
Hi,
That’s okay, what do you get back if you just use:
<?php if(get_field('color')) {
$color = get_field('color');
echo $color;
}?>
Hi,
What you would need to do would be something along the lines of:
<?php if(get_field('color')) {
$color = get_field('color'); ?>
<div class="title-item" style="background-color:<?php echo $color ?>;">
<?php } else { ?>
<div class="title-item">
<?php } ?>
<h4><?php the_title(); ?></h4>
</div>
Hi,
I’ve just given it a go with a combination of another function to autopopulate it with today’s date but the field itself is still clickable. Is this supposed to happen or is the function you have given not worked?
function my_acf_update_value( $value, $post_id, $field )
{
$time = date('d/m/Y');
$value = $time ;
return $value;
}
add_filter('acf/update_value/name=updated', 'my_acf_update_value', 10, 3);
add_filter('acf/load_field/name=updated', 'sampleFunction');
function sampleFunction( $field ){ $field['disabled']='1'; return $field; }
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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.