How to fix Astra’s theme problem with Sensei LMS for online courses

astra theme templates

The Astra theme is perfect for almost everything, but if you have tried to use it to make an academy in which to sell online courses you will have realized that the Sensei LMS plugin indicates that it is not compatible, but above all, that the Astra styles are not applied correctly to your courses, modules and sections.

This is because, by default, Astra is not fully compatible with Sensei LMS, something that fortunately has an easy solution.

The trick is to add code that allows Astra styles to be loaded correctly into your courses, modules and lessons. The steps are these:

  1. If you haven’t done it yet, create a child theme for Astra and activate it.
  2. In the functions.php file of the child theme add the code below and save your changes.
/* Deactivate default theme from Sensei */
global $woothemes_sensei;
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );
/* Load correct Sense layout for Astra */
function astra_child_sensei_wrapper_start() {
$site_sidebar = astra_page_layout();
if ( 'left-sidebar' == $site_sidebar ) {
get_sidebar();
}
?>
<div id="primary" class="content-area primary">
<?php astra_primary_content_top(); ?>
<main id="main" class="site-main" role="main">
<div class="ast-lifterlms-container">
<?php
}
function astra_child_sensei_wrapper_end() {
?>
</div> <!-- .ast-lifterlms-container -->
</main> <!-- #main -->
<?php astra_primary_content_bottom(); ?>
</div> <!-- #primary -->
<?php
$site_sidebar = astra_page_layout();
if ( 'right-sidebar' == $site_sidebar ) {
get_sidebar();
}
}
add_action('sensei_before_main_content', 'astra_child_sensei_wrapper_start', 10);
add_action('sensei_after_main_content', 'astra_child_sensei_wrapper_end', 10);
/* Declarar compatibilidad con Sensei */
function astra_child_declare_sensei_support() {
add_theme_support( 'sensei' );
}
add_action( 'after_setup_theme', 'astra_child_declare_sensei_support' );Code language: HTML, XML (xml)

Once this is done your Sensei LMS courses will be shown correctly and will be adapted to the styles you apply with the Astra theme, either the free or the pro version.

Read this post in Spanish: Cómo adaptar los estilos del tema Astra para cursos online con Sensei LMS

How useful was this post?

Click on a smiley to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top