Enable excerpts for LearnDash Lessons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Enable excerpts for LearnDash Lessons | |
*/ | |
function add_excerpts_to_ld_lessons() { | |
add_post_type_support( 'sfwd-lessons', 'excerpt' ); | |
} | |
add_action( 'init', 'add_excerpts_to_ld_lessons' ); |
The following is a solution provided by LearnDash LMS support team to add an extract to courses:
add_filter( 'learndash_post_args', function( $post_args = array() ) {
if ( !isset( $post_args['sfwd-courses']['cpt_options']['supports'] ) )
$post_args['sfwd-courses']['cpt_options']['supports'] = array();
$post_args['sfwd-courses']['cpt_options']['supports'][] = 'excerpt';
// always return the $post_args array
return $post_args;
}, 10, 1 );
Thanks a lot for this beautiful snippet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notice that the function name in
add_action
doesn't match the function name.Here it is fixed: