lifterlms_get_archive_description()
Retrieve the archive description for LifterLMS catalogs pages and post type / tax archives.
Description Description
If content is added to the course/membership catalog page via the WP editor, output it as the archive description before the loop.
Return Return
(string)
Source Source
File: includes/functions/llms.functions.templates.loop.php
* @return string
*/
function lifterlms_get_archive_description() {
$content = '';
$page_id = false;
// Get the page id for the catalog page setup in LLMS settings.
if ( is_post_type_archive( 'course' ) || is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track' ) ) ) {
$page_id = llms_get_page_id( 'courses' );
} elseif ( is_post_type_archive( 'llms_membership' ) || is_tax( array( 'membership_tag', 'membership_cat' ) ) ) {
$page_id = llms_get_page_id( 'memberships' );
}
// If a description is setup for the taxonomy term, use that description.
if ( is_tax( array( 'course_cat', 'course_tag', 'course_difficulty', 'course_track', 'membership_tag', 'membership_cat' ) ) ) {
$content = get_the_archive_description();
}
// If we don't have a description, try to pull it from the page's content area.
if ( empty( $content ) && (int) $page_id > 0 ) {
$page = get_post( $page_id );
$content = $page ? $page->post_content : $content;
}
/**
* Filter the archive description
*
* @since Unknown
* @since 4.10.0 Added `$page_id` parameter.
*
* @param string $content HTML description string.
* @param int|false $page_id WP_Post ID of the archive page being displayed.
*/
return apply_filters( 'llms_archive_description', llms_content( $content ), $page_id );
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.10.0 | Introduced. |