I’m trying to use this filter to display an image at the top of each flexible content layout:https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/
add_filter('acf/fields/flexible_content/layout_title/name=my_flex_field', 'my_acf_fields_flexible_content_layout_title', 10, 4);
function my_acf_fields_flexible_content_layout_title( $title, $field, $layout, $i ) {
// Remove layout name from title.
$title = '';
// Display thumbnail image.
if( $image = get_sub_field('image') ) {
$title .= '<div class="thumbnail"><img src="' . esc_url($image['sizes']['thumbnail']) . '" height="36px" /></div>';
}
// load text sub field
if( $text = get_sub_field('text') ) {
$title .= '<b>' . esc_html($text) . '</b>';
}
return $title;
}
But the thumbnail is not in the right position (see image). It should be placed before the title. Is this a bug?
Inspect the elements and see if there is any CSS that is causing it.