learndash_resume_link_text
Filters the text displayed for the "Resume" link on LearnDash course navigation, allowing customization of its appearance.
add_filter( 'learndash_resume_link_text', $callback, 10, 1 );
Description
Filters the text displayed for the "Resume" link on LearnDash courses. Developers can use this hook to customize the default "Resume" text, for example, to provide more context-specific language based on the course or user. This hook fires after the default text is determined and before it's rendered.
Usage
add_filter( 'learndash_resume_link_text', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
add_filter( 'learndash_resume_link_text', 'my_custom_learndash_resume_link_text', 10, 1 );
/**
* Customizes the text displayed for the "Resume" button in LearnDash.
*
* @param string $resume_link_text The current text for the resume link.
* @return string The modified text for the resume link.
*/
function my_custom_learndash_resume_link_text( $resume_link_text ) {
// Example: Append a specific course identifier if it's a particular course.
// In a real-world scenario, you'd likely get the course ID from the global context
// or pass it via another filter if available. For this example, let's assume
// we're targeting a specific (hypothetical) course ID.
$target_course_id = 123; // Replace with an actual LearnDash course ID
// This check would be more robust in a real application, likely involving
// checking if the current course being displayed matches the target.
// For demonstration, we'll just append text unconditionally.
// A more advanced example might check global $post or use other hooks to get context.
// You can also modify based on the current user role or other conditions.
if ( is_user_logged_in() && current_user_can( 'subscriber' ) ) {
$resume_link_text = 'Continue Course';
}
// You can also completely replace the text
// $resume_link_text = 'Pick Up Where You Left Off';
return $resume_link_text;
}
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-resume.php:237
src/classes/learn-dash-resume.php:394
if ( strlen( trim( $link_text ) ) ) {
$resume_link_text = __( $link_text, 'uncanny-learndash-toolkit' );
} else {
$resume_link_text = __( 'Resume', 'uncanny-learndash-toolkit' );
}
$resume_link_text = apply_filters( 'learndash_resume_link_text', $resume_link_text );
$css_classes = apply_filters( 'learndash_resume_css_classes', 'learndash-resume-button' );
ob_start();
if ( function_exists( 'learndash_get_step_permalink' ) ) {
$permalink = learndash_get_step_permalink( $step_id, $step_course_id );