mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 10:46:11 +09:00
Add filters for primary button classes in UM forms
Introduced new filters to customize CSS classes for primary buttons in login, registration, and password reset forms. This allows developers to extend button styling by applying custom classes via WordPress hooks. Changes enhance flexibility and improve theme compatibility.
This commit is contained in:
@@ -362,7 +362,26 @@ function um_add_submit_button_to_login( $args ) {
|
||||
if ( ! isset( $primary_btn_word ) || $primary_btn_word == '' ){
|
||||
$primary_btn_word = UM()->options()->get( 'login_primary_btn_word' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the classes applied to the primary button on the login form.
|
||||
*
|
||||
* @hook um_login_form_primary_btn_classes
|
||||
* @since 2.10.5
|
||||
*
|
||||
* @param {array} $classes An array of CSS classes applied to the primary button.
|
||||
* @param {array} $args An array of arguments or configurations used in the login form.
|
||||
*
|
||||
* @return {array} Button CSS classes.
|
||||
*
|
||||
* @example <caption>Extend the classes applied to the primary button on the login form.</caption>
|
||||
* function my_custom_classes( $classes, $args ) {
|
||||
* // Add a new class to the button
|
||||
* $classes[] = 'new-button-class';
|
||||
*
|
||||
* return $classes;
|
||||
* }
|
||||
* add_filter( 'um_login_form_primary_btn_classes', 'my_custom_classes', 10, 2 );
|
||||
*/
|
||||
$primary_btn_classes = apply_filters( 'um_login_form_primary_btn_classes', array( 'um-button' ), $args );
|
||||
|
||||
/**
|
||||
|
||||
@@ -597,6 +597,26 @@ function um_add_submit_button_to_register( $args ) {
|
||||
$primary_btn_word = UM()->options()->get( 'register_primary_btn_word' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the classes applied to the primary button on the registration form.
|
||||
*
|
||||
* @hook um_register_form_primary_btn_classes
|
||||
* @since 2.10.5
|
||||
*
|
||||
* @param {array} $classes An array of CSS classes applied to the primary button.
|
||||
* @param {array} $args An array of arguments or configurations used in the registration form.
|
||||
*
|
||||
* @return {array} Button CSS classes.
|
||||
*
|
||||
* @example <caption>Extend the classes applied to the primary button on the registration form.</caption>
|
||||
* function my_custom_classes( $classes, $args ) {
|
||||
* // Add a new class to the button
|
||||
* $classes[] = 'new-button-class';
|
||||
*
|
||||
* return $classes;
|
||||
* }
|
||||
* add_filter( 'um_register_form_primary_btn_classes', 'my_custom_classes', 10, 2 );
|
||||
*/
|
||||
$primary_btn_classes = apply_filters( 'um_register_form_primary_btn_classes', array( 'um-button' ), $args );
|
||||
|
||||
$secondary_btn_word = $args['secondary_btn_word'];
|
||||
|
||||
@@ -120,6 +120,26 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*/
|
||||
do_action( 'um_after_password_reset_fields', $args );
|
||||
|
||||
/**
|
||||
* Filters the classes applied to the primary button on the password reset form.
|
||||
*
|
||||
* @hook um_password_reset_form_primary_btn_classes
|
||||
* @since 2.10.5
|
||||
*
|
||||
* @param {array} $classes An array of CSS classes applied to the primary button.
|
||||
* @param {array} $args An array of arguments or configurations used in the password reset form.
|
||||
*
|
||||
* @return {array} Button CSS classes.
|
||||
*
|
||||
* @example <caption>Extend the classes applied to the primary button on the password reset form.</caption>
|
||||
* function my_custom_classes( $classes, $args ) {
|
||||
* // Add a new class to the button
|
||||
* $classes[] = 'new-button-class';
|
||||
*
|
||||
* return $classes;
|
||||
* }
|
||||
* add_filter( 'um_password_reset_form_primary_btn_classes', 'my_custom_classes', 10, 2 );
|
||||
*/
|
||||
$primary_btn_classes = apply_filters( 'um_password_reset_form_primary_btn_classes', array( 'um-button' ), $args );
|
||||
?>
|
||||
<div class="um-col-alt um-col-alt-b">
|
||||
|
||||
Reference in New Issue
Block a user