Snippet: Add a Course Thumbnail to the LearnDash Course List Rows
The plain ld_course_list rows show only a title link. Add the featured image, a short excerpt and a price label with the row template hooks, keep it responsive, and know when Course Grid takes over instead.

Without the Course Grid add-on, the core [ld_course_list] shortcode and the Course List block render each course as a bare row: a title link and nothing else. That is fine for a sidebar, but a catalogue page wants a picture. The ld30 row template in LearnDash 4.18.0.1 fires several actions inside each row, and one of them sits exactly where a thumbnail belongs. This snippet adds the featured image, an optional excerpt and a price label to every row without overriding the template, then styles the result.
The row template and its hooks
themes/ld30/templates/course/partials/row.php receives course_id and user_id for each course in the list. Inside the row's wrapper it fires, in order, learndash-course-row-status-before, learndash-course-row-link-before, then prints the title link, then learndash-course-row-certificate-before, learndash-course-row-expand-before and learndash-course-row-expand-after. Every hook receives ( $course_id, $user_id ). Content printed on learndash-course-row-link-before appears immediately before the title, which is where a thumbnail reads naturally; content on learndash-course-row-expand-after lands after the title, which suits an excerpt or a price.
Snippet: thumbnail before the title
<?php
add_action(
'learndash-course-row-link-before',
function ( $course_id, $user_id ) {
if ( ! has_post_thumbnail( $course_id ) ) {
return;
}
$link = get_permalink( $course_id );
$attributes = array(
'class' => 'wwc-course-row-thumb',
'href' => esc_url( $link ),
'aria-label' => esc_attr( get_the_title( $course_id ) ),
'tabindex' => '-1',
);
$attribute_html = '';
foreach ( $attributes as $name => $value ) {
$attribute_html .= sprintf( ' %1$s="%2$s"', $name, $value );
}
printf(
'<a%1$s>%2$s</a>',
$attribute_html, // Values escaped above.
get_the_post_thumbnail( $course_id, 'medium', array( 'loading' => 'lazy' ) )
);
},
10,
2
);
The image is wrapped in its own link so that clicking the picture opens the course, but with tabindex="-1" so keyboard users are not asked to tab through two links to the same place; the title link remains the accessible one. get_the_post_thumbnail() returns escaped markup with width, height and srcset attributes, and the medium size keeps the file small; register a dedicated size with add_image_size() if your design needs exact proportions.
Snippet: excerpt and price after the title
<?php
add_action(
'learndash-course-row-expand-after',
function ( $course_id, $user_id ) {
$excerpt = get_the_excerpt( $course_id );
$price = learndash_get_course_price( $course_id );
$label = '';
if ( isset( $price['type'] ) ) {
if ( 'free' === $price['type'] || 'open' === $price['type'] ) {
$label = __( 'Free', 'wwc' );
} elseif ( isset( $price['price'] ) && '' !== $price['price'] ) {
$label = learndash_get_price_formatted( $price['price'] );
}
}
echo '<div class="wwc-course-row-meta">';
if ( $excerpt ) {
echo '<p class="wwc-course-row-excerpt">' . esc_html( wp_trim_words( $excerpt, 24 ) ) . '</p>';
}
if ( $label ) {
echo '<span class="wwc-course-row-price">' . esc_html( $label ) . '</span>';
}
echo '</div>';
},
10,
2
);
learndash_get_course_price() returns an array with type and price; the price for subscriptions is the recurring amount, so add the interval yourself if you show it. learndash_get_price_formatted() applies the site currency and locale formatting. For courses sold through WooCommerce the LearnDash price is usually empty and the label stays blank, which is correct.
CSS
The row's inner div stacks children vertically by default. A little flexbox turns it into a media object:
.ld-item-list .ld-item-list-item [id^="course-"] > div {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 1rem;
}
.wwc-course-row-thumb {
flex: 0 0 160px;
}
.wwc-course-row-thumb img {
display: block;
width: 100%;
height: auto;
border-radius: 6px;
}
.wwc-course-row-meta {
flex-basis: 100%;
margin-left: calc(160px + 1rem);
font-size: 0.9rem;
}
.wwc-course-row-price {
font-weight: 600;
}
@media (max-width: 600px) {
.wwc-course-row-thumb { flex-basis: 100%; }
.wwc-course-row-meta { margin-left: 0; }
}
The attribute selector targets the row's id, which the template builds as course-{user}-{course}, so the rule applies only to course rows and not to lesson or topic lists that share the item list classes.
When Course Grid takes over
With the Course Grid add-on active, the core shortcode's course_grid attribute defaults to true and the list renders through Course Grid's legacy card, which already has a thumbnail; the row template and its hooks never run. Pass course_grid="false" to use the plain rows with this snippet, or use Course Grid's own cards. Our comparison of catalogue options helps decide which to keep.
Performance
Thumbnails add one image request per course, which lazy loading defers below the fold. get_the_excerpt() and learndash_get_course_price() read data already loaded with the post, so there are no extra queries per row. On lists of more than a few dozen courses, the shortcode's own num attribute and pagination keep the page light.
Combining with progress classes
The same row template exposes a class filter and a status hook, so the thumbnail list can also show a completed badge or a coloured border per learner; our progress-based row classes snippet adds those and shares the flexbox layout above. If you also want the list to behave as a filterable catalogue with categories, the [ld_course_list] attributes category_name, tag and categoryselector cover that without code.
Choosing and preparing images
The thumbnail is the course's featured image, so the same picture appears on the single course page, in Course Grid cards if you later switch, and in social previews. Pick one aspect ratio for every course, 16:9 or 3:2 are the usual choices, and crop to it before upload so rows line up. A registered size such as add_image_size( 'wwc-course-row', 480, 270, true ) with hard cropping guarantees the ratio even when an editor uploads something else; regenerate thumbnails after adding it so existing courses get the new size. Courses without an image show no gap because the snippet returns early, but a catalogue looks tidier when every course has one, so a placeholder image set as the featured image is better than none.
Accessibility details
The featured image's alt text comes from the media library, which is often empty for decorative course art. Because the picture link carries an aria-label with the course title and is removed from the tab order, screen reader users hear one link per course, the title, and are not read an empty image. If your images carry meaning, such as a chart or a badge, fill in their alt text in the media library and remove the tabindex so the image link becomes a second, labelled stop. Check the result with a screen reader rather than assuming; course lists are usually the first thing a new learner navigates.
Testing
- Place
[ld_course_list course_grid="false" num="6"]on a test page. - Confirm each course with a featured image shows it before the title, and courses without one simply show the title.
- Check a free, a paid and a subscription course for the price label.
- Resize to a phone width and confirm the image stacks above the title.
- Tab through the list with the keyboard: one stop per course, on the title.
When to get help
A thumbnail row is an hour including styling. A designed catalogue with filtering, sorting and category landing pages is where our LearnDash services team and UI and UX design come in, and a LearnDash developer can build it as a custom template with the hooks preserved.
Frequently asked questions
Which hook adds content before the course title in ld_course_list rows?
learndash-course-row-link-before, fired in the ld30 row partial with the course ID and user ID. Use learndash-course-row-expand-after for content after the title.
Why does my thumbnail not appear?
Either the course has no featured image, or the Course Grid add-on is active and rendering its legacy card. Add course_grid="false" to the shortcode.
Can I show the price in the row?
Yes. learndash_get_course_price( $course_id ) returns the type and amount, and learndash_get_price_formatted() formats it in the site currency.
Does this affect lesson and topic lists?
No. Those use their own row partials. The CSS targets the course row's id prefix so it does not leak.
Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.
