ACF: If field contain a specific value, update value in another field programatically

Did you trying something like this in a JS script? Assuming you wants to edit the service text field. jQuery(document).ready(() => { const textfield_type = document.querySelector(‘input[name=”type”]’); const textfield_service = document.querySelector(‘input[name=”service”]’); const updateField = () => { if (textfield_type.getAttribute(‘value’) === ‘Houses’ && textfield_service.getAttribute(‘value’) === ‘2’) { textfield_service.setAttribute(‘value’, ‘NOT AVAILABLE’); } // … other rules } // … Read more

If/Else Statement for Advanced Custom Fields

<?php if( get_field(‘parent_repeater’) ) : while( has_sub_field(‘parent_repeater’) ) : $some_bool = get_sub_field(‘true’); $sf1 = get_sub_field(‘sub_field_1’); $sf2 = get_sub_field(‘sub_field_2’); if( $some_bool == true ){ echo $sf1 . $sf2; } else { echo $sf1; } endwhile; endif; ?> You must use the non-echoing version of the function. Use the get version. Also, I advise you to use … Read more

Can’t get “has_sub_field()” to work in a conditional [closed]

You need to use the has_sub_field() method inside an if() statement. I’ve only included the affected code below to highlight the specific changes required. if (has_sub_field(‘vimeo_id’)): // Added if() // … endif; You also need to a use the get_sub_field() function here as opposed to the has_sub_field() function: <iframe src=”https://player.vimeo.com/video/<?php echo get_sub_field(‘vimeo_id’); ?>”></iframe>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)