This is my code, I put it in Buddyboss custom javacript code
<script>
jQuery(document).ready(function($) {
// Delay execution until LearnDash content is loaded
$(window).on('load', function() {
// Replace the selector with the actual class or ID of your Elementor lesson list
var lessonList = $('#ld-course-list-content-9f3deeb6159f0f2a6b15e0706ecf8794');
// Replace 'data-learndash-lesson-id' with the actual data attribute that stores LearnDash lesson ID
var lessonIdAttribute = '69';
// Sort lessons based on the LearnDash lesson ID in ascending order
lessonList.children().sort(function(a, b) {
var lessonIdA = parseInt($(a).attr(lessonIdAttribute));
var lessonIdB = parseInt($(b).attr(lessonIdAttribute));
return lessonIdA - lessonIdB;
}).appendTo(lessonList);
// Hide all lessons initially
lessonList.find('[' + lessonIdAttribute + ']').hide();
// Replace with an array of specific LearnDash lesson IDs you want to filter
var targetLessonIds = ['5194', '5195', '5199', '5205', '4307', '4294', '5207', '5203', '5201', '5197'];
// Show only the lessons with the specified LearnDash lesson IDs
$.each(targetLessonIds, function(index, lessonId) {
var lessonElement = lessonList.find('[' + lessonIdAttribute + '="' + lessonId + '"]');
lessonElement.show();
});
});
});
</script>
Supposedly it should follow this list
What happened the display is not showing the right order.
This is the current display right now.
Please help me on this.
Thank you