Interesting. Thanks for this, I’ll take a look.
Very odd. Tried both Object and ID and neither seemed to work the other day. Just tried again now and things worked perfectly. Might have been one of those things where I’d coded something else incorrectly and that was having a knock on affect to that code. Anyway, all good now with that code. I used “Term Object” BTW to get it to display.
Unfortunately that’s the problem with anything random. I have my caching plugin clear the cache once an hour so obviously not ideal at least it’s random 24 times a day 😉
If you can figure something out I’d be interested to hear how you did it.
Hi. Yep, I tried your code above, but it didn’t even display the gallery field.
Realise this is an old post but I’ve tried using the following code:
<?php
global $sitepress;
$current_main_id = icl_object_id( get_the_id(), 'post', true, $sitepress->get_default_language() );
$awards_images = get_field('our_wines_awards', $current_main_id);
if( $awards_images ): ?>
<ul class="press awards cf">
<?php foreach( $awards_images as $awards_image ): ?>
<li>
<img src="<?php echo $awards_image['sizes']['large']; ?>" alt="<?php echo $awards_image['alt']; ?>" />
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
But it still seemingly displays the images in a completely random order.
Am I doing something wrong in my code?
Thanks for this John. Really appreciate the speedy response.
Umm, mine seems to be working correctly now. I did just update to ACF Pro 5.2.7 from 5.2.6 and initially it didn’t work so I just left it, came back and it now works?! Very odd.
This looks like a bug. I am using the Flexible Content field and if I use it as a Select Field from that then it doesn’t work. However, if I have a Select field within a Repeater field in the Flexible Content section then it works as it should.
Hi John. This is what we’re both trying to say. Using the original poster’s example:
This code:
<?php echo the_field('intro_text_shadow_color'); ?>
Should be displaying the value i.e. light_green
However it’s not and I’m having the same issue. It’s displaying the Label and not the value.
How strange. I’ve just been having the exact same issue. From reading the select resource page if you have a value and label it should be the value that’s displayed in the template. i.e. we should only need to add all of the code above if you want to display the label. However the value is not displaying either way.
Hi @jonathan
What currently happens is if I change a text field (for example) in French. It changes it in both languages. What seems to be happening is that it’s simply duplicating the content across the languages as opposed to allowing me to translate the field.
There’s no option anywhere to give me this ability.
Hi. Not sure what screenshots of the Options page you’d like me to post? Can you please explain.
With the multilingual set up I am referring to WPML > Translation Management > Multilingual Content Set up > Custom fields translation
This is where you have to specify what custom fields you want translating, copying or to ignore as with all other ACF fields.
Fields that are added to an ACF Options Page are not included in this section and so there’s no way of being able to use WPML to translate the Options page custom fields.
Thanks for replying but unfortunately this doesn’t help. The issue I’m having is with the “Options Page”. I have looked at the “Translating Options Page Compatibility” section on that page but I shouldn’t need to add that code as it states “ACF contains WPML support out of the box”.
The custom fields that I’ve added to the Options page do not show up in the “Custom Fields Translation” within WPML. All other ACF custom fields do so I presume it’s because they are on the Options Page that they are not showing up.
Hi. Just realised that the above code is incorrect as that doesn’t get the current category’s ID. This should work…
<?php
$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;
if(get_field('cat_image', 'category_'. $cat_id .'')) { ?>
<?php the_field('cat_image', 'category_'. $cat_id .''); ?>
<?php endif; ?>
Okay, I’ve figured this out:
<?php if( $image['caption'] ): ?>
<div class="caption"><?php echo $image['caption']; ?></div>
<?php endif; ?>
Also check out this page How to get values from a taxonomy term
I’ve just had to do the same thing displaying the image url and this is how IO did it…
<?php if(get_field('cat_image', 'category_'. the_category_ID( $echo ) .'')) { ?>
<?php the_field('cat_image', 'category_'. the_category_ID( $echo ) .''); ?>
<?php endif; ?>
This worked for me.
Perfect. Thanks so much for your help with this @ractoon
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.