@daretothink Sorry ignore the above, mod please remove
@daretothink
Try the following, I think its failing because the id and image vars are outside your loop:
<?php
global $sitepress;
if( $awards_images ): ?>
<ul class="press awards cf">
<?php foreach( $awards_images as $awards_image ):
$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);
?>
<li>
<img src="<?php echo $awards_image['sizes']['large']; ?>" alt="<?php echo $awards_image['alt']; ?>" />
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Much shorter function here, does the same thing and pulls in the images from the original posts gallery:
global $sitepress;
$current_main_id = icl_object_id( get_the_id(), 'post', true, $sitepress->get_default_language() );
$images = get_field('gallery', $current_main_id);
Elliot many thanks, however I have just updated and I still have this issue. Its worth noting I have multiple taxonomy fields within the edit post area.
Hmm it should be possible by tapping into the existing fields, name, display name etc etc.
If not you might have to use a plugin like: https://wordpress.org/plugins/profile-builder/
Hi adechriz
you can use get_the_author_meta( $field, $userID )
See here for more details:
http://codex.wordpress.org/Function_Reference/get_the_author_meta
@udapud you’re welcome, glad its working!
Hi @udapud
In the admin at the bottom underneath where you are adding the new HTML / WYSIWYG fields there should be an area called ‘location’ here you can set rules which decide where the new fields you have just created will appear.
You will need to select ‘Post Type’ – ‘is equal to’ – ‘NAME OF YOUR CUSTOM POST TYPE’
When your client edits one of the custom posts they will see the new WYSIWYG.
You can call it in the custom post template with
the_field('YOUR FIELD NAME')
Hope this helps
Rich
@dominic Thank you so much for the detailed reply, it was a huge help.
pre_save_post was the way to go and the problem is solved 🙂
@dominic thanks that worked a treat!! The users meta is saving correctly and can be edited in the same form, perfect.
Cheeky side question, the theme im using has a similar form for creating / editing posts, if I use the same code as above the post does save however it also saves to the users meta, how would I use the code above but for post creation / editing?
@elliot thanks again for your help!
Hi Elliot
Thank you so much, adding the code you suggested into the form save worked a charm.
The only remaining issue I am having is that when a user returns to edit the same form once registered the ACF fields are not automatically populated with the saved user meta from the original registration.
I have checked in the admin and all the user meta is being saved correctly.
Thanks again
Rich
Hi Sorry to jump in on Dominic’s thread but I have used the code above in a similar scenario and the fields are appearing, I just need to get them to save to the new users profile
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.