LifterLMS Conditional Tags

Introduction

# Top

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.

Where to use conditional tags

# Top

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.

Conditional Tags

# Top

 

Any LifterLMS Page #

is_lifterlms()

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 #

is_llms_account_page()

Returns true if the LifterLMS Student Dashboard (account page) is being displayed, otherwise returns false.

The Checkout Page #

is_llms_checkout()

Returns true if the LifterLMS Checkout page is being displayed, otherwise returns false.

A Single Course #

is_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 #

is_course_tag( $term = ” )

Returns true when a LifterLMS course tag archive page is being displayed, otherwise returns false.

Any Course Taxonomy Archive #

is_course_taxonomy()

Returns true when any LifterLMS course taxonomy archive page is being displayed, otherwise returns false.

Course Catalog (Post Type Archive) #

is_courses()

Returns true when the LifterLMS course catalog (or course post type archive) is being displayed, otherwise returns false.

A Single Lesson #

is_lesson()

Returns true when a single LifterLMS lesson is being displayed, otherwise returns false.

A Single Quiz #

is_quiz()

Returns true when a single LifterLMS quiz is being displayed, otherwise returns false.

A Single Membership #

is_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 #

is_membership_taxonomy()

Returns true when any LifterLMS membership taxonomy archive page is being displayed, otherwise returns false.

Membership Catalog (Post Type Archive) #

is_memberships()

Returns true when the LifterLMS membership catalog (or membership post type archive) is being displayed, otherwise returns false.

Last Updated on
Was this article helpful?