• Hello All.

    Maybe someone knows how I can add custom “CSS Class” for Custom Fields. (Register Page, Profile Page).

    Maybe someone has some snippet that they find “meta_key” field and then add custom css class to this field?

    Thanks All!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support andrewshu

    (@andrewshu)

    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.

    Thread Starter andriiwork

    (@andriiwork)

    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 1 year, 8 months ago by Yui.
    • This reply was modified 1 year, 8 months ago by andriiwork.
    • This reply was modified 1 year, 8 months ago by andriiwork.
    • This reply was modified 1 year, 8 months ago by andriiwork.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fields custom class’ is closed to new replies.