Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Template_Loader::get_maybe_forced_template()

Retrieve the hierarchical template to be loaded.


Return Return

(null|string)


Top ↑

Source Source

File: includes/class.llms.template.loader.php

	 * @return null|string
	 */
	private function get_maybe_forced_template() {

		$page_restricted = llms_page_restricted( get_the_ID() );
		$template        = null;

		if ( $page_restricted['is_restricted'] ) {

			// Blog should bypass checks, except when sitewide restrictions are enabled.
			if ( ( is_home() && 'sitewide_membership' === $page_restricted['reason'] ) ||
					// Course and membership content restrictions are handled by conditional elements in the editor.
					( in_array( get_post_type(), array( 'course', 'llms_membership' ), true ) ) ) {
				return;
			}

			// Content is restricted.
			$template = 'single-no-access';

		} elseif ( is_post_type_archive( 'course' ) || is_page( llms_get_page_id( 'courses' ) ) ) {

			$template = 'archive-course';

		} elseif ( is_post_type_archive( 'llms_membership' ) || is_page( llms_get_page_id( 'memberships' ) ) ) {

			$template = 'archive-llms_membership';

		} elseif ( is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {

			global $wp_query;
			$obj      = $wp_query->get_queried_object();
			$template = 'taxonomy-' . $obj->taxonomy;

		} elseif ( is_singular( array( 'llms_certificate', 'llms_my_certificate' ) ) ) {

			$template = 'single-certificate';

		}

		/**
		 * Filters the template to be loded forced.
		 *
		 * @since 5.8.0
		 *
		 * @param string $template The template slug to be loaded forced.
		 */
		return apply_filters( 'llms_forced_template', $template );


Top ↑

Changelog Changelog

Changelog
Version Description
5.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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