Content for unenrolled students displays for enrolled students when using the Twenty Sixteen theme

We store content for non-enrolled users in the post field reserved for excerpts. On Twenty Sixteen this causes an issue for enrolled and non-enrolled students alike.

You can resolve this by adding this to your functions.php file of a child theme or via a custom plugin.

<?php // Don't copy this line!
/**
* llms-twentysixteen-compat.php
*
* @since 2016-09-12
*/
/**
* Custom twenty sixteen excerpt to pevent "restricted content" from being displayed
* on courses
* @see https://github.com/gocodebox/lifterlms/issues/184
* @param string $class classes to add
* @return void
*/
function twentysixteen_excerpt( $class = 'entry-summary' ) {
if ( function_exists( 'is_course' ) && is_course() ) {
return;
}
$class = esc_attr( $class );
if ( has_excerpt() || is_search() ) : ?>
<div class="<?php echo $class; ?>">
<?php the_excerpt(); ?>
</div><!-- .<?php echo $class; ?> -->
<?php endif;
}

Last Updated on
Was this article helpful?