Update. My bad about the strpos() !== -1. Instead, those should be strpos() !== FALSE. Also, I was finding errors on some other jQuery-heavy admin pages, so I added a javascript check for the ‘.acf-color_picker’ element. Here’s my revised code:
function load_javascript_on_admin_edit_post_page() {
global $parent_file;
// If we're on the edit post page.
if (
strpos($parent_file, 'post-new.php') !== FALSE ||
strpos($parent_file, 'edit.php') !== FALSE ||
strpos($parent_file, 'post.php') !== FALSE
) {
echo "
<script>
jQuery(document).ready(function($){
if ($('.acf-color_picker').length) {
$('.acf-color_picker').iris({
palettes: ['#e40571', '#4b63a4', '#ffcb05', '#fff', '#000'],
change: function(event, ui){
$(this).parents('.wp-picker-container').find('.wp-color-result').css('background-color', ui.color.toString());
}
});
}
});
</script>
";
}
}
add_action('in_admin_footer', 'load_javascript_on_admin_edit_post_page');
I’m trying this with version 5, and I had to adjust this a little — to change the jQuery selector from ‘.color_picker’ to ‘.acf-color_picker’. Here’s my code:
function load_javascript_on_admin_edit_post_page() {
global $parent_file;
// If we're on the edit post page.
if (
strpos($parent_file, 'post-new.php') !== -1 ||
strpos($parent_file, 'edit.php') !== -1 ||
strpos($parent_file, 'post.php') !== -1
) {
echo "
<script>
jQuery(document).ready(function(){
jQuery('.acf-color_picker').iris({
palettes: ['#e40571', '#4b63a4', '#ffcb05', '#fff', '#000'],
change: function(event, ui){
jQuery(this).parents('.wp-picker-container').find('.wp-color-result').css('background-color', ui.color.toString());
}
});
});
</script>
";
}
}
add_action('in_admin_footer', 'load_javascript_on_admin_edit_post_page');
Aw shucks, Joel. I’m blushing. 🙂
I downloaded and installed the latest “acf-master” from Github. Works fine for me now. Admin fields work properly, and the public display pages are showing the relationships, too.
Thanks Elliot!
(P.S. I’ve only installed this on a development copy of the site, not on the live site yet. I’ll wait for the official dot-release.)
I had the same issue: ttp://support.advancedcustomfields.com/forums/topic/relationship-field-not-displaying-data/
A fix is in the works.
Thanks Elliot. I’m really impressed by ACF. Keep up the great work!
Confirmed that 4.2.0 works. Just tried that, and it works fine. So I took a look at the changelog, and it says “Relationship Field: Add new option for return_format”. So I played around with that option on the admin screen, thinking that maybe I just needed to re-save the field type. No joy.
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.