LifterLMS Conditional Tags
These conditional tags can be used in the same way that the core WordPress conditional tags can be used, except these conditional tags apply specifically to LifterLMS templates and content types.
Each conditional function returns either true
 if the condition is met or false
 if the condition is not met.
For example, if is_course()
 if used on a template for a LifterLMS Course, it will return true
, but if it is used anywhere else (like on a WordPress page) it will return false
.
Conditional tags only work after WordPress post data has been retrieved from the database. If you use a tag before the main WP_Query
has run the condition will always return false because there’s no data to check against.
It’s best to add conditional tags to your theme or child theme’s template files. You can also add conditional tags within functions that are loaded in your theme’s functions.php
or in plugins but always be careful that your tags are run using a hook that runs after the WP_Query
.
Any LifterLMS Page #
Returns true
when a single LifterLMS post type, post type archive, or taxonomy archive is being displayed, otherwise returns false
.
Note: This tag does not check against LifterLMS pages that utilize shortcodes on regular WordPress pages like the Student Dashboard or the Checkout Page.
The Student Dashboard #
Returns true
if the LifterLMS Student Dashboard (account page) is being displayed, otherwise returns false
.
The Checkout Page #
Returns true
if the LifterLMS Checkout page is being displayed, otherwise returns false
.
A Single Course #
Returns true
when a single LifterLMS course is being displayed, otherwise returns false
.
A Course Category Archive #
is_course_category( $term = ” )
Returns true
when a LifterLMS course category archive page is being displayed, otherwise returns false
.
A Course Tag Archive #
Returns true
when a LifterLMS course tag archive page is being displayed, otherwise returns false
.
Any Course Taxonomy Archive #
Returns true
when any LifterLMS course taxonomy archive page is being displayed, otherwise returns false
.
Course Catalog (Post Type Archive) #
Returns true
when the LifterLMS course catalog (or course post type archive) is being displayed, otherwise returns false
.
A Single Lesson #
Returns true
when a single LifterLMS lesson is being displayed, otherwise returns false
.
A Single Quiz #
Returns true
when a single LifterLMS quiz is being displayed, otherwise returns false
.
A Single Membership #
Returns true
when a single LifterLMS membership is being displayed, otherwise returns false
.
A Membership Category Archive #
is_membership_category( $term = ” )
Returns true
when a LifterLMS membership category archive page is being displayed, otherwise returns false
.
A Membership Tag Archive #
is_membership_tag( $term = ” )
Returns true
when a LifterLMS membership tag archive page is being displayed, otherwise returns false
.
Any Membership Taxonomy Archive #
Returns true
when any LifterLMS membership taxonomy archive page is being displayed, otherwise returns false
.
Membership Catalog (Post Type Archive) #
Returns true
when the LifterLMS membership catalog (or membership post type archive) is being displayed, otherwise returns false
.