Filter tin-canny-learndash-reporting

uo_tin_can_filter_content_label

Filters the label for the content filter in the Tin Can reporting, allowing customization of the displayed text.

add_filter( 'uo_tin_can_filter_content_label', $callback, 10, 1 );

Description

Filters the label displayed for the "Content" dropdown in Tin Can API reporting. Developers can modify this label to customize the user interface for filtering content within Uncanny Learndash Reporting's Tin Can reporting section.


Usage

add_filter( 'uo_tin_can_filter_content_label', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

/**
 * Example of how to use the uo_tin_can_filter_content_label filter.
 * This filter allows you to change the default label 'Content' for the content filter section.
 *
 * @param string $label The default label for the content filter.
 * @return string The modified label for the content filter.
 */
add_filter( 'uo_tin_can_filter_content_label', 'my_custom_tin_can_content_label', 10, 1 );

function my_custom_tin_can_content_label( $label ) {
    // Example: Append 'Filter' to the label if it's the default 'Content'.
    if ( $label === esc_html_x( 'Content', 'Tin Can Filter Content label', 'uncanny-learndash-reporting' ) ) {
        return $label . ' Filter';
    }

    // Example: Always change the label to 'Learning Content'.
    // return __( 'Learning Content', 'your-text-domain' );

    // If no specific modification is needed, return the original label.
    return $label;
}

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/reporting/xapi-quiz/templates/xapi-quiz-filter.php:142
src/reporting/tin-can/templates/tc-tincan-filter.php:146

</div>
                        </div>
                    </div>

                    <div class="reporting-tincan-filters-col reporting-tincan-filters-col--2">

                        <div class="reporting-tincan-section__title">
							<?php echo apply_filters( 'uo_tin_can_filter_content_label', esc_html_x( 'Content', 'Tin Can Filter Content label', 'uncanny-learndash-reporting' ) ); ?>
                        </div>
                        <div class="reporting-tincan-section__content">
                            <div class="reporting-tincan-section__field">
                                <label for="tc_filter_course"><?php echo ucfirst( apply_filters( 'uo_tin_can_filter_course_label', esc_html_x( 'Course', 'Tin Can Filter Group name', 'uncanny-learndash-reporting' ), false ) ); ?></label>
                                <select class="uo-admin-select" name="tc_filter_course" id="tc_filter_course">
                                    <option value="">
										<?php


Scroll to Top