learndash_reset_css_classes
Filters the CSS classes applied to the LearnDash reset button for customization.
add_filter( 'learndash_reset_css_classes', $callback, 10, 1 );
Description
Filters the CSS classes applied to the reset button within LearnDash. Developers can use this to customize the button's appearance by adding or modifying classes. This hook fires when the reset button shortcode is rendered.
Usage
add_filter( 'learndash_reset_css_classes', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Add a custom CSS class to the LearnDash reset button.
*
* This filter allows developers to add or modify CSS classes applied to the
* button that triggers the course reset functionality in LearnDash.
*
* @param string $css_classes The default CSS classes for the reset button.
* @return string The modified CSS classes.
*/
add_filter( 'learndash_reset_css_classes', function( $css_classes ) {
// Add a new class 'my-custom-reset-button' to the existing classes.
return $css_classes . ' my-custom-reset-button';
}, 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:217
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(
'<form id="learndash-reset-course-%s" method="POST" class="%s" name="learndash-reset-course">%s '