uo_course_grid_after_action_buttons
Fires after course action buttons are displayed in the course grid.
add_action( 'uo_course_grid_after_action_buttons', $callback, 10, 1 );
Description
Fires after the action buttons (like "Resume" or "Enroll") are displayed on the course grid. Use this hook to inject custom content or modify the button section. The `$course` object is passed, allowing context-aware additions.
Usage
add_action( 'uo_course_grid_after_action_buttons', 'your_function_name', 10, 1 );
Parameters
-
$course(mixed) - This parameter holds the course object for which the action buttons are being displayed.
Examples
<?php
/**
* Adds a custom button after the action buttons in the course grid.
*
* This function demonstrates how to hook into the 'uo_course_grid_after_action_buttons'
* action hook to add custom content or functionality after the default action buttons
* (like resume or start course) are displayed for a course in the grid.
*
* @param object $course The course object being displayed in the grid.
*/
add_action( 'uo_course_grid_after_action_buttons', function( $course ) {
// Check if the course object is valid and has an ID.
if ( ! is_object( $course ) || ! isset( $course->ID ) ) {
return;
}
// Example: Add a "View Course Details" button if the user is logged in.
if ( is_user_logged_in() ) {
$course_details_url = get_permalink( $course->ID );
$button_text = __( 'View Details', 'your-text-domain' );
// You could also add conditional logic here based on user enrollment or course status.
// For example, if the user is already enrolled, you might show a different button.
echo '<a href="' . esc_url( $course_details_url ) . '" class="button uo-course-grid-details-button">' . esc_html( $button_text ) . '</a>';
}
}, 10, 1 ); // Priority 10, accepts 1 argument ($course)
?>
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:255
);
echo apply_filters( 'uo_course_grid_resume_button', $resume_button_html, $course );
}
}
}
?>
<?php do_action_deprecated( 'uo-course-grid-after-action-buttons', array( $course ), '3.7.11', 'uo_course_grid_after_action_buttons' ); ?>
<?php do_action( 'uo_course_grid_after_action_buttons', $course ); ?>
</div>
<?php
}
}
?>
</div>
</div>