Skip to content

Instantly share code, notes, and snippets.

@devendrabisht
Last active June 5, 2019 16:55
Show Gist options
  • Save devendrabisht/c2a8063ae7a124a5cbbdbcb06100143c to your computer and use it in GitHub Desktop.
Save devendrabisht/c2a8063ae7a124a5cbbdbcb06100143c to your computer and use it in GitHub Desktop.
How to enable comments with "Focus Mode" enabled for LearnDash elements ( Course, Lesson, Topic, Quiz ) - LD3
/**
* Code to activate comments for LearnDash elements.
*/
add_filter( 'learndash_focus_mode_comments', 'learnwithbisht_learndash_focus_mode_comments', 10, 2 );
function learnwithbisht_learndash_focus_mode_comments( $closed, $post ) {
/**
* Code to activate comments for course.
*/
if( 'sfwd-courses' === $post->post_type ) {
$closed = 'open';
}
/**
* Code to activate comments for lesson.
*/
if( 'sfwd-lessons' === $post->post_type ) {
$closed = 'open';
}
/**
* Code to activate comments for topic.
*/
if( 'sfwd-topic' === $post->post_type ) {
$closed = 'open';
}
/**
* Code to activate comments for quiz.
*/
if( 'sfwd-quiz' === $post->post_type ) {
$closed = 'open';
}
return $closed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment