|
<?php |
|
|
|
/** |
|
* Add more social fields. |
|
* Add this code to the file functions.php in the active theme directory. |
|
*/ |
|
add_filter( 'um_predefined_fields_hook', function( $predefined_fields ) { |
|
|
|
$predefined_fields['pinterest'] = array( |
|
'title' => __( 'Pinterest', 'ultimate-member' ), |
|
'metakey' => 'pinterest', |
|
'type' => 'url', |
|
'label' => __( 'Pinterest', 'ultimate-member' ), |
|
'required' => 0, |
|
'public' => 1, |
|
'editable' => 1, |
|
'url_target' => '_blank', |
|
'url_rel' => 'nofollow', |
|
'icon' => 'um-icon-social-pinterest', |
|
'validate' => 'pinterest_url', |
|
'url_text' => 'Pinterest', |
|
'advanced' => 'social', |
|
'color' => '#e60023', |
|
'match' => 'https://www.pinterest.com/', |
|
); |
|
|
|
$predefined_fields['twitch'] = array( |
|
'title' => __( 'Twitch', 'ultimate-member' ), |
|
'metakey' => 'twitch', |
|
'type' => 'url', |
|
'label' => __( 'Twitch', 'ultimate-member' ), |
|
'required' => 0, |
|
'public' => 1, |
|
'editable' => 1, |
|
'url_target' => '_blank', |
|
'url_rel' => 'nofollow', |
|
'icon' => 'um-icon-social-twitch', |
|
'validate' => 'twitch_url', |
|
'url_text' => 'Twitch', |
|
'advanced' => 'social', |
|
'color' => '#6441a5', |
|
'match' => 'https://www.twitch.tv/', |
|
); |
|
|
|
return $predefined_fields; |
|
} ); |
|
|
|
|
|
add_filter( 'um_admin_field_validation_hook', function( $array ) { |
|
$array['pinterest_url'] = __('Pinterest URL','ultimate-member'); |
|
$array['twitch_url'] = __('Twitch URL','ultimate-member'); |
|
return $array; |
|
} ); |
This gist is a part of the article Сustom social fields
Documentation: https://docs.ultimatemember.com/
Support forum: https://wordpress.org/support/plugin/ultimate-member/