php – Display LearnDash parent course title beside lesson title

Question

I have installed LearnDash on my WordPress site, and I am using the following snippet to get a list of all lessons:

function get_list_of_lessons_class(){
$args = array(
    'post_type' => 'sfwd-lessons',
    'posts_per_page' => -1,
    'post_status' => 'publish',
    );
$q = new WP_Query($args);
    if ($q->have_posts()) : 
        while ($q->have_posts()) :  $q->the_post();
        the_title();
        endwhile; 
    else:
        ;
        wp_reset_postdata();
    endif;
return $finaloutput;
}
add_shortcode('get_list_of_lessons', 'get_list_of_lessons_class');

Can anyone advise please how to display the course title of each lesson as well?

Any help would be appreciated.

0
majid 1 month 2021-05-13T01:48:37-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse