Action uncanny-toolkit-pro

uo_course_grid_before_course_info_holder

Fires before the course information holder on the course grid, providing access to the current course object.

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

Description

Fires before the main course information holder in the course grid. Developers can use this hook to add content or modify the layout before the course title, price, and other details are displayed, allowing for custom elements or advanced customizations.


Usage

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

Parameters

$course (mixed)
This parameter contains the current course object being displayed in the grid.

Examples

/**
 * Example function to hook into 'uo_course_grid_before_course_info_holder'.
 * This function demonstrates adding a custom badge or status indicator
 * before the main course information on the course grid.
 *
 * @param WP_Post $course The current course post object.
 */
function my_custom_course_grid_badge( $course ) {
	// Check if the course is marked as 'featured' in post meta.
	$is_featured = get_post_meta( $course->ID, 'is_featured_course', true );

	if ( 'yes' === $is_featured ) {
		// Output a custom badge for featured courses.
		echo '<div class="custom-featured-badge">Featured Course</div>';
	}
}
add_action( 'uo_course_grid_before_course_info_holder', 'my_custom_course_grid_badge', 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/templates/course-grid.php:32

$completed_class = 'completed';
}
?>
<div class="<?php echo esc_attr( implode( ' ', $grid_classes ) ); ?>">
	<div class="uo-border <?php echo esc_attr( $completed_class ); ?>">
		<a href="<?php echo esc_url_raw( $permalink ); ?>">
			<?php do_action_deprecated( 'uo-course-grid-before-course-info-holder', array( $course ), '3.7.11', 'uo_course_grid_before_course_info_holder' ); ?>
			<?php do_action( 'uo_course_grid_before_course_info_holder', $course ); ?>
			<!-- Price Ribbon section -->
			<?php if ( 'yes' === $atts['price'] && 'yes' === $atts['show_image'] ) { ?>
				<div id="ribbon"
					 class="price <?php echo ! empty( $course_price_type ) ? esc_attr( 'price_' . $currency ) : esc_html( $course_price_type ); ?>">
					<?php
					do_action( 'uo_course_before_grid_ribbon_text', $course->ID );
					if ( empty( $course_price ) ) {


Scroll to Top