Snippet: Change the Course Grid Ribbon Text for Completed Courses
Use learndash_course_grid_ribbon_text and learndash_course_grid_ribbon_class to relabel and restyle the Completed, Enrolled, Free and price ribbons on LearnDash Course Grid cards, per course or site-wide.

The ribbon in the corner of a LearnDash Course Grid card tells the visitor where they stand: Enrolled, Completed, Free, a price, or Available. The wording is fixed in the plugin, and while the per-course Custom Ribbon Text field lets you override it for one course, that override replaces every state with the same string. When you want "Completed" to read "Done" or "Certificate earned" everywhere, or want the completed ribbon in a different colour, the right tool is a filter. Course Grid 2.0.9 provides two, and this snippet shows how to use them.
How the ribbon is decided
Every card is built from an array returned by learndash_course_grid_prepare_template_post_attributes(). Inside it, the ribbon logic runs in this order: a non-empty Custom Ribbon Text from the course's meta box wins outright; otherwise, for courses and groups, the plugin checks enrollment and completion and picks Enrolled, Completed, the formatted price, Free, or Available, with a reduced set for open courses. Lessons and topics get Completed, Not started, In progress or Free sample. Each state also appends a class to a base class of ribbon, giving ribbon completed, ribbon enrolled, ribbon free and so on.
The result passes through two filters just before the array is returned:
learndash_course_grid_ribbon_textwith the text, the post ID and the price type.learndash_course_grid_ribbon_classwith the class string, the post ID and the course options array.
Because the filters receive the final text rather than the state, your callback identifies the state by comparing the text to the plugin's own translated strings, or by checking completion directly with a LearnDash function. The second approach is more reliable on multilingual sites.
Snippet 1: relabel the completed ribbon
<?php
/**
* Change the Course Grid ribbon text for courses the current user has completed.
*
* @param string $text Ribbon text chosen by the plugin.
* @param int $post_id Course, group, lesson or topic ID.
* @param string $price_type Price type of the course or group.
*
* @return string
*/
function wwc_course_grid_completed_ribbon( $text, $post_id, $price_type ) {
if ( 'sfwd-courses' !== get_post_type( $post_id ) || ! is_user_logged_in() ) {
return $text;
}
if ( learndash_course_completed( get_current_user_id(), $post_id ) ) {
return __( 'Certificate earned', 'wwc' );
}
return $text;
}
add_filter( 'learndash_course_grid_ribbon_text', 'wwc_course_grid_completed_ribbon', 10, 3 );
This runs after the per-course Custom Ribbon Text is applied, so it also overrides that field on completed courses. If you want the manual field to keep priority, read _learndash_course_grid_custom_ribbon_text from the post meta first and return $text unchanged when it is set.
Snippet 2: relabel by matching the state text
When you only want to change wording and not add logic, map the plugin's strings to yours:
<?php
function wwc_course_grid_ribbon_labels( $text, $post_id, $price_type ) {
$map = [
__( 'Enrolled', 'learndash-course-grid' ) => __( 'You are in', 'wwc' ),
__( 'Completed', 'learndash-course-grid' ) => __( 'Done', 'wwc' ),
__( 'Available', 'learndash-course-grid' ) => __( 'Open for enrollment', 'wwc' ),
];
return isset( $map[ $text ] ) ? $map[ $text ] : $text;
}
add_filter( 'learndash_course_grid_ribbon_text', 'wwc_course_grid_ribbon_labels', 10, 3 );
Using the plugin's text domain in the lookup keys means the comparison works whatever language the site runs in, as long as the translation files are loaded before the grid renders, which they are on the front end.
Snippet 3: add a class and style it
The class filter lets you add hooks for CSS without touching templates:
<?php
function wwc_course_grid_ribbon_classes( $class, $post_id, $course_options ) {
if ( learndash_course_completed( get_current_user_id(), $post_id ) ) {
$class .= ' wwc-ribbon-done';
}
if ( has_term( 'featured', 'ld_course_category', $post_id ) ) {
$class .= ' wwc-ribbon-featured';
}
return $class;
}
add_filter( 'learndash_course_grid_ribbon_class', 'wwc_course_grid_ribbon_classes', 10, 3 );
Then add CSS scoped to the grid's wrapper so it does not leak into other components:
.learndash-course-grid .ribbon.wwc-ribbon-done {
background-color: #0f766e;
color: #ffffff;
}
.learndash-course-grid .ribbon.wwc-ribbon-featured {
background-color: #b45309;
}
Site-wide ribbon colours can also be set without code through the background_color_ribbon and font_color_ribbon attributes or the block's style panel, but those apply to every state at once; the class route is for per-state styling.
Snippet 4: hide the ribbon for one state
Returning an empty string removes the ribbon, because the card templates only print it when the text is non-empty:
<?php
add_filter(
'learndash_course_grid_ribbon_text',
function ( $text, $post_id, $price_type ) {
if ( __( 'Available', 'learndash-course-grid' ) === $text ) {
return '';
}
return $text;
},
10,
3
);
To hide ribbons entirely, use the ribbon="false" attribute or the block toggle instead; the filter is for selective removal.
Combining the filter with the per-course field
The two mechanisms stack in a fixed order: the Custom Ribbon Text field sets the text first, the state logic only runs when that field is empty, and your filter runs last and sees whichever won. A workable convention is to let the field express marketing labels such as "New" or "Staff pick" and let the filter own state labels. To implement that, read the meta at the top of the callback and return early when it is set, so a course with a manual label never has it overridden by a completion label. If instead the completion state should always win, as in snippet 1, document it for editors, because a "New" ribbon that quietly turns into "Certificate earned" for returning learners is correct behaviour that looks like a bug to the person who typed "New".
Where the change applies
Both filters run for the shortcode, the block, AJAX-loaded pages from the Load More button and the filter bar, and the legacy v1 card used by [ld_course_list course_grid="true"], because all of them call the same attributes function. Cards that hide the ribbon, such as grid-3, are unaffected. If you have overridden a card template in your theme and removed the ribbon markup, the filter has nothing to change; our guide to overriding Course Grid templates explains where that markup lives.
Caching
Ribbon state depends on the logged-in user, so pages containing a grid should not be served from a full-page cache for logged-in visitors. If they are, every visitor sees the ribbons computed for whoever warmed the cache. This is true with or without the snippet, but a custom label makes the problem more visible. The per-course grid settings guide covers the Custom Ribbon Text field for cases where a fixed label per course is all you need.
When to get help
Relabelling is a small job. Ribbons that depend on cohort dates, seat availability, prerequisites or data from outside LearnDash need the attributes filter and often a custom card, which our LearnDash services team builds as part of catalog projects; a LearnDash developer can usually turn a sketch of the card into a working template in a day. The complete list of grid hooks is in the Course Grid hooks reference.
Frequently asked questions
Why does my ribbon filter not change the text on some courses?
Those courses probably have Custom Ribbon Text set in their meta box, and your callback matches on the plugin's standard strings, which never appear for them. Check the meta or match on completion state instead.
Can I change the ribbon for groups?
Yes. The same filters run for group cards; use learndash_is_user_in_group() and the group progress functions in place of the course completion check.
Does the filter affect the course page itself?
No. It applies only to Course Grid cards. Course page status labels come from the LearnDash theme templates.
Can I return HTML in the ribbon text?
Not in the 2.x cards, which print the text through esc_html(), so tags are shown literally. Only the legacy v1 card uses wp_kses_post(). Use the class filter and CSS for icons or styling.
Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.
