llms_focus_mode_body_class( array $classes )

Add body classes for focus mode.


Parameters Parameters

$classes

(array) (Required) Body classes.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/functions/llms.functions.template.php

function llms_focus_mode_body_class( $classes ) {
	/**
	 * Post types that can use the focus mode template when focus mode is enabled.
	 *
	 * Add-ons (e.g. LifterLMS Assignments) can add their post types here and use
	 * the `llms_is_focus_mode_enabled` filter to return true when appropriate.
	 *
	 * @since 10.0.0
	 *
	 * @param string[] $post_types Post type names. Default: [ 'lesson', 'llms_quiz' ].
	 */
	$focus_mode_post_types = apply_filters( 'llms_focus_mode_post_types', array( 'lesson', 'llms_quiz' ) );
	if ( is_singular( $focus_mode_post_types ) && llms_is_focus_mode_enabled( get_the_ID() ) ) {
		$classes[] = 'llms-focus-mode';

		$width = llms_get_focus_mode_content_width( get_the_ID() );
		if ( 'full' !== $width ) {
			$classes[] = 'llms-focus-mode-width-' . $width;
		}

		$position  = llms_get_focus_mode_sidebar_position( get_the_ID() );
		$classes[] = 'llms-focus-mode-sidebar-' . $position;
	}
	return $classes;
}


Top ↑

Changelog Changelog

Changelog
Version Description
10.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.