|
<?php |
|
|
|
/** |
|
* Change the $href variable to an URL that navigates to a page you need |
|
* and change the $title variable to a button text you need |
|
* then add this code to the functions.php file in the theme directory. |
|
*/ |
|
|
|
// Add a custom button (link) on user profile. |
|
function um_custom_button_in_profile( $args ) { |
|
$href = home_url( '' ); |
|
$title = 'Custom form'; |
|
?> |
|
<div class="um-profile-custom-btn"> |
|
<a href="<?php echo esc_attr( $href ); ?>" class="um-custom-btn um-button"><?php echo esc_html( $title ); ?></a> |
|
</div> |
|
<?php |
|
} |
|
add_action( 'um_profile_navbar', 'um_custom_button_in_profile', 4 ); |
|
|
|
// Add a custom button (link) for each member on member directory. |
|
function um_custom_button_in_member_directory( $args ) { |
|
$href = home_url( '' ); |
|
$title = 'Custom form'; |
|
?> |
|
<div class="um-members-custom-btn"> |
|
<a href="<?php echo esc_attr( $href ); ?>" class="um-custom-btn um-button"><?php echo esc_html( $title ); ?></a> |
|
</div> |
|
<?php |
|
} |
|
add_action( 'um_members_just_after_name_tmpl', 'um_custom_button_in_member_directory', 110, 1 ); // for grid. |
|
add_action( 'um_members_list_just_after_actions_tmpl', 'um_custom_button_in_member_directory', 110, 1 ); // for list. |
|
|
|
// Style a custom button. |
|
function um_custom_button_styles() { |
|
?> |
|
<style type="text/css"> |
|
.um-profile .um-profile-custom-btn { |
|
float: right; |
|
margin: 0px 0px 0px 5px; |
|
} |
|
.um-profile a.um-custom-btn { |
|
padding: 10px 15px !important; |
|
} |
|
|
|
.um-members.um-members-grid a.um-custom-btn { |
|
display: inline-block !important; |
|
font-size: 13px; |
|
margin: 0 auto !important; |
|
min-width: 110px; |
|
padding: 10px 15px !important; |
|
text-align: center; |
|
transition: none !important; |
|
width: auto; |
|
} |
|
.um-members.um-members-list a.um-custom-btn { |
|
font-size: 13px; |
|
padding: 10px 15px !important; |
|
} |
|
</style> |
|
<?php |
|
} |
|
add_action( 'wp_footer', 'um_custom_button_styles' ); |