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:
Mykyta Synelnikov
2025-06-05 16:06:21 +03:00
parent 723219e66a
commit 2368771617
3 changed files with 60 additions and 1 deletions
+20 -1
View File
@@ -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 );
/**
+20
View File
@@ -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'];
+20
View File
@@ -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">