Thank you that is very usefull too!
Pretty shure this topic was forgotten but does this got implemented? This will help to better organize options for a theme.
That’s just awesome! Selecting all in one click, time saving. Tank you!
Problem is that double clicking selects also the type column http://prntscr.com/pmqlio
Thank you James, I’ve got the idea, If you don’t mind Im posting it publicly with a little modification to show thumbnails so it could be of use for anyone with this issue.
function admin_avatar() {
global $current_user;
$current_screen = get_current_screen();
$avatar = get_field('custom_avatar', 'user_' . $current_user->ID );
if( $avatar ) :
if( $current_screen->id == 'acf-field-group' || $current_screen->id == 'custom-fields_page_acf-settings-tools' ) :
$avatar = wp_get_attachment_image_src($avatar, 'thumbnail');
echo '<img src="' . $avatar[0] . '">';
else :
echo '<img src="' . $avatar['sizes']['thumbnail'] . '">';
endif;
endif;
}
add_filter('adminmenu', 'admin_avatar');
Sure James
I made a short version of it.
Forgot to mention, wp version is 4.7.1
// The field - set in user profile
// Note that return_format is set to 'array'
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_58018033d8b8a',
'title' => 'Profile Avatar',
'fields' => array (
array (
'key' => 'field_5801803c55db7',
'label' => 'Avatar',
'name' => 'custom_avatar',
'type' => 'image',
'required' => 0,
'conditional_logic' => 0,
'return_format' => 'array',
'preview_size' => 'thumbnail',
'library' => 'all',
),
),
'location' => array (
array (
array (
'param' => 'user_form',
'operator' => '==',
'value' => 'edit',
),
),
),
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'active' => 1,
));
endif;
// Stuff happening
function admin_avatar() { ?>
<style>
#acf-custom-avatar {width: 50%;box-sizing: border-box; padding: 0 12px;}
#user-meta {float: right; width: 50%; color: white;}
</style>
<?php
global $current_user;
$avatar = get_field('custom_avatar', 'user_' . $current_user->ID );
echo '<div style="padding-top: 22px;">';
if( $avatar ) :
echo '<img id="acf-custom-avatar" src="' . $avatar['url'] . '">';
endif;
echo '<span id="user-meta">Howdy<br>' . $current_user->display_name . '</span></div>';
}
add_filter('adminmenu', 'admin_avatar');
Same problem here.
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.