Last active
June 5, 2019 16:55
-
-
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
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
/** | |
* 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