Fields custom class | WordPress.org

[ad_1]

Hello @andriiwork

You could try to use this hook:

add_filter( 'um_field_extra_atts', 'um_add_field_class', 10, 3 );
function um_add_field_class( $field_atts, $key, $data ) {
	$field_atts['class'][] = 'your_class';

	return $field_atts;
}

Regards.

Hello. @andrewshu
This snippet work. Thanks.

But I have small problem.

This snippet add my custom class to all fields =( (And add to <DIV> class not to <INPUT>)

add_filter( 'um_field_extra_atts', 'um_add_field_class', 10, 3 );
function um_add_field_class( $field_atts, $key, $data ) {
$field_atts['class']['test_meta_key9'] = 'wpdatepicker';
return $field_atts;
}

  • This reply was modified 24 minutes ago by Yui.
  • This reply was modified 21 minutes ago by andriiwork.
  • This reply was modified 16 minutes ago by andriiwork.
  • This reply was modified 9 minutes ago by andriiwork.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer