learndash_focus_mode_can_view_comments

apply_filters( 'learndash_focus_mode_can_view_comments',  boolean $load_focus_comments )

Filters whether to load comments in focus mode or not.


Description #


Parameters #

$load_focus_comments

(boolean) Whether to comments in focus mode or not.


Source #

File: themes/ld30/templates/focus/index.php


Examples #

 <?php
/**
 * Example usage for learndash_focus_mode_can_view_comments filter.
 */

add_filter(
	'learndash_focus_mode_can_view_comments',
	function( $can_view_comments = false ) {
		if ( ! is_user_logged_in() ) {

			// Alternate example check the course price type. If 'open' allow comments.
			$course_id = learndash_get_course_id();
			if ( ! empty( $course_id ) ) {
				$course_price_type = learndash_get_setting( $course_id, 'course_price_type' );
				if ( 'open' === $course_price_type ) {
					$can_view_comments = true;
				}
			}
		}

		// Always return $can_view_comments.
		return $can_view_comments;
	},
	30,
	1
);