uo_dashboard_heading
Filters the main heading displayed on the user dashboard, allowing customization of the title for courses or other core elements.
add_filter( 'uo_dashboard_heading', $callback, 10, 1 );
Description
Filters the heading displayed on the Uncanny Dashboard's primary courses registration area. Developers can modify the heading text or the label used for "courses." This hook fires before the heading is displayed.
Usage
add_filter( 'uo_dashboard_heading', 'your_function_name', 10, 1 );
Parameters
-
$uo_dashboard_heading(mixed) - This parameter holds the heading text for the Uncanny Dashboard, which can be modified by the filter.
Return Value
The filtered value.
Examples
/**
* Example callback function for the 'uo_dashboard_heading' filter hook.
* This function will prepend "My Courses: " to the default dashboard heading.
*
* @param string $uo_dashboard_heading The original dashboard heading string.
* @param string $learndash_courses_label The LearnDash custom label for 'courses'.
* @return string The modified dashboard heading string.
*/
function my_custom_uo_dashboard_heading( $uo_dashboard_heading, $learndash_courses_label ) {
// Let's assume the original heading is something like "Registered Courses".
// We want to change it to "My Registered Courses".
// We can directly modify the string or use the provided $learndash_courses_label
// if we want to be more dynamic.
$modified_heading = 'My ' . $uo_dashboard_heading;
// Or, if we wanted to be more specific about the label:
// $modified_heading = sprintf( __( 'My %s', 'my-text-domain' ), $learndash_courses_label );
return $modified_heading;
}
add_filter( 'uo_dashboard_heading', 'my_custom_uo_dashboard_heading', 10, 2 ); // 10 is the priority, 2 is the number of arguments accepted
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/templates/frontend-dashboard/dashboard-template.php:52
function learndash_get_step_permalink( $module_id, $course_id ) {
return get_permalink( $module_id );
}
}
$uo_dashboard_heading = sprintf( esc_attr__( 'Registered %s', 'uncanny-pro-toolkit' ), LearnDash_Custom_Label::get_label( 'courses' ) );
$uo_dashboard_heading = apply_filters( 'uo_dashboard_heading', $uo_dashboard_heading, LearnDash_Custom_Label::get_label( 'courses' ) );
// Add Statistics Modal Window
if ( class_exists( 'SFWD_LMS' ) ) {
if ( ! isset( $learndash_assets_loaded['scripts']['learndash_template_script_js'] ) ) {
$filepath = SFWD_LMS::get_template( 'learndash_template_script.js', null, null, true );
if ( ! empty( $filepath ) ) {
wp_enqueue_script( 'learndash_template_script_js', str_replace( ABSPATH, '/', $filepath ), array( 'jquery' ), LEARNDASH_VERSION, true );