learndash_reset_form_css_classes
Filters the CSS classes applied to the LearnDash reset form, allowing for customization of its appearance.
add_filter( 'learndash_reset_form_css_classes', $callback, 10, 1 );
Description
Filters the CSS classes applied to the LearnDash course reset form. Developers can modify or add classes to customize the form's appearance when it's displayed, for example, to apply custom styling.
Usage
add_filter( 'learndash_reset_form_css_classes', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Add a custom CSS class to the LearnDash reset form.
*
* This function demonstrates how to hook into the 'learndash_reset_form_css_classes'
* filter to modify the CSS classes applied to the LearnDash course reset form.
*
* @param string $form_css_classes The current CSS classes for the reset form.
* @return string The modified CSS classes.
*/
function my_custom_learndash_reset_form_classes( $form_css_classes ) {
// Add a new custom class 'my-custom-reset-form' to the existing classes.
// We'll also ensure no duplicate classes are added if the filter is applied multiple times.
$new_class = 'my-custom-reset-form';
$classes_array = explode(' ', $form_css_classes);
if ( ! in_array( $new_class, $classes_array, true ) ) {
$classes_array[] = $new_class;
}
// Reconstruct the string of CSS classes.
return implode( ' ', $classes_array );
}
add_filter( 'learndash_reset_form_css_classes', 'my_custom_learndash_reset_form_classes', 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/classes/learn-dash-reset.php:216
if ( strlen( trim( $link_text ) ) ) {
$reset_link_text = $link_text;
}
$reset_link_text = apply_filters( 'learndash_reset_link_text', $reset_link_text );
$referer = isset( $atts['redirect'] ) && ! empty( $atts['redirect'] ) ? false : true;
$form_css_classes = apply_filters( 'learndash_reset_form_css_classes', 'learndash-reset-form' );
$css_classes = apply_filters( 'learndash_reset_css_classes', 'learndash-reset-button' );
$nonce_field = wp_nonce_field( 'learndash_reset_course', 'learndash_reset_course_nonce', $referer, false );
ob_start();
printf(