Home › Forums › Backend Issues (wp-admin) › acf/fields/flexible_content/layout_title › Reply To: acf/fields/flexible_content/layout_title
hi there,
i am trying to get this to function to work, i have called the Field ‘blocktitle’
i have added the following function to the function.php, what do i have to do next to make it work? the documentation is not clear
function my_acf_flexible_content_layout_title( $title, $field, $layout, $i ) {
// remove layout title from text
$title = ”;
// load sub field image
// note you may need to add extra CSS to the page t style these elements
$title .= ‘<div class=”thumbnail”>’;
if( $image = get_sub_field(‘image’) ) {
$title .= ‘‘;
}
$title .= ‘</div>’;
// load text sub field
if( $text = get_sub_field(‘text’) ) {
$title .= ‘<h4>’ . $text . ‘</h4>’;
}
// return
return $title;
}
// name
add_filter(‘acf/fields/flexible_content/layout_title/name=my_flex_field’, ‘my_acf_flexible_content_layout_title’, 10, 4);
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.