Thanks for explaining some more. The filter solution works with adding the class BUT the styles seamless / WP Metabox are being reset. If anyone’s going to use this code, make sure that you re-include seamless into $content[‘style’], else you get the WP metabox style.
I’ve contacted Elliot via Twitter. I’ll explain what i mean exactly and will update this topic when necessary.
Thanks for your help Hube!
Thanks!
Ended up with this:
function change_style_test($content) {
switch ($content['title']) {
case 'Title1':
$content['style'] = 'acf-postbox-title1';
break;
case 'Title2':
$content['style'] = 'acf-postbox-title2';
break;
default:
$content['style'] = 'seamless';
break;
}
/*
// Test to see output
echo '<pre>';
print_r($content);
echo '</pre>';
*/
return $content;
}
add_filter('acf/get_field_group', 'change_style_test');
It can be automized though, sanitize the title and add that as a class.
BTW, i’m not that experienced with using filters in WordPress. Is it possible to get an overview of filters and actions launched in a plugin? Or is it just digging around?
But, it would still be great to have some <wrapper start> and </wrapper end> field in ACF so you have more control of the structure and looks of ACF.
No, i saw the wrappers. But this is for individual fields only. It’s not possible at the moment to wrap 5 fields in 1 wrapper, right?
I my example i’m adding a class for the ACF group. I didn’t find any ways to add a class or ID to the group either. I could be missing something though.
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.