Support

Account

Home Forums General Issues How to display default language Options field, when no WPML translation exists Reply To: How to display default language Options field, when no WPML translation exists

  • This is great, thanks a lot, will give it a go.

    But are we able to tell if a field is a sub-field? Some of my values use get_sub_field() so not sure how to tell if the field needs get_field or get_sub_field. The above code is not working on all my values just because some use get_sub_field but the code uses only get_field

    Saying that, it doesn’t work when changing it to get_sub_field anyway. Is it because its in a loop? Here is one such code for example, that I need to display the English content if the translation does not exist.

    <?php
    if( have_rows('enquire_link', 'option') ):
    	while( have_rows('enquire_link', 'option') ): the_row();
    ?>
    		<a href="<?php the_sub_field('link'); ?>" class="enquire-button">
    			<?php the_sub_field('text'); ?>
    		</a>
    <?php
    	endwhile;
    endif;
    ?>

    So in the above, the have_rows() check is false, nothing in the loop is being executed so probably does not even get to your acf/load_value hook.
    Thanks