Action uncanny-toolkit-pro

uo_course_after_grid_ribbon_text

Fires after the course ribbon text is displayed in the course grid, allowing for custom modifications.

add_action( 'uo_course_after_grid_ribbon_text', $callback, 10, 1 );

Description

Fires after the course grid ribbon text is displayed. Use this hook to add custom content or modify the ribbon display after the default price or label has been outputted. It receives the course ID.


Usage

add_action( 'uo_course_after_grid_ribbon_text', 'your_function_name', 10, 1 );

Parameters

$course (mixed)
This parameter contains the ID of the course that is currently being displayed in the grid.

Examples

add_action( 'uo_course_after_grid_ribbon_text', 'my_custom_course_ribbon_enhancement', 10, 1 );

/**
 * Adds a custom badge to the course grid ribbon if the course is marked as "featured".
 *
 * @param int $course_id The ID of the current course being displayed.
 */
function my_custom_course_ribbon_enhancement( $course_id ) {
	// Check if the course is marked as featured using a custom field.
	// Replace 'is_featured' with your actual meta key if it's different.
	$is_featured = get_post_meta( $course_id, 'is_featured', true );

	if ( ! empty( $is_featured ) && $is_featured === 'yes' ) {
		echo '<span class="course-ribbon-badge featured-course-badge">Featured</span>';
	}
}

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/course-grid.php:66

break;

							default:
								$output = esc_html( $course_price_type );
								break;
						}
						echo wp_kses_post( apply_filters( 'uo_course_grid_ribbon_text', $output, $course->ID ) );
						do_action( 'uo_course_after_grid_ribbon_text', $course->ID );
					} else {
						echo wp_kses_post( apply_filters( 'uo_course_grid_ribbon_price', $course_price, $course->ID ) );
						do_action( 'uo_course_after_grid_ribbon_price', $course->ID );
					}

					?>
				</div>


Scroll to Top