Home › Forums › Feedback › ACF Postbox classes / CSS identifiers › Reply To: ACF Postbox classes / CSS identifiers
Thanks for this guys was very helpful. If you don’t want to replace the existing style just use .= to append your style, simply remember to have it be a space before your class.
And if you need to only affect a specific metabox you can use the $content[‘ID’] to compare.
Here’s what I’ve done to add Woo’s hide_if_external class to remove my metabox for external products;
function change_style_test($content) {
if ( ! empty( $content ) && array_key_exists( 'ID', $content ) && ! empty( $content['ID'] ) && $content['ID'] == 4970) {
$content['style'] .= ' hide_if_external';
}
return $content;
}
add_filter('acf/get_field_group', 'change_style_test');
All the best,
Cheers
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.