Sensei LMS page theme support for content wrapper

I know this is a bit out of the support rhelm, but thought i would post as others may have this same issue.

Pro theme does not declare theme support by default fo Sensei LMS. I followed this guide and got mostly there: https://senseilms.com/documentation/enabling-theme-support/

This is what i added in my functions doc:

// Sensei wrapper fix for theme support
// =============================================================================


add_action( 'after_setup_theme', 'declare_sensei_support' );
function declare_sensei_support() {
    add_theme_support( '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 );



add_action('sensei_before_main_content', 'my_theme_wrapper_start', 10);
add_action('sensei_after_main_content', 'my_theme_wrapper_end', 10);

function my_theme_wrapper_start() {
  echo '<div class="x-container max width offset sensei-custom-wrapper">
    	<div class="x-main left" role="main">';
}

function my_theme_wrapper_end() {

  echo '</div>';
  get_sidebar();
  echo '</div>';
}

This worked all around except for the single course page. It seams for some reason to add the sidebar and footer within the <div class="x-main left" role="main"> area. This then messes up the page layout.

I believe this is happening because the page is structured differently and i’m not able to set a pro theme template to the page.

My question is:

  • is it possible to exclude the course page? Either a function that does it for all pages? Or by adding the Id’s of the specific courses?
  • otherwise is there any way to make this work all around?

The lessons pages without the function as well as the single course pages work just fine without the custom wrappers, however the messages and results pages don’t work at all without it.

Thank you in advance!

Hello @eyedia,

Thank you very much for the very detailed post information.

1.) To exclude the course page, you will have to add a condition is_singular( 'course' ) to your code above.

2.) We need to check one of your pages to find out why it is broken. Kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Hi Ruenel,
Thank you for your response!
I will certainly try using that condition to fix the issues if there isn’t another work around.

This is the course registration page using Sensei LMS paid courses: https://eng.menardsafetycoursesonline.ca/course/online-babysitting-course-age-10/

I do have pro enabled on that page and have jazzed it up with page builder content.

Again i think the one big issue with the single course page is that I cannot select a pro page template like i can on pages, posts or lessons. You will see on that single course page how the footer and sidebar are getting wrapped within the left content area.

Thank you! I will pass this info after to the sensei support team as well to see if they can add to their docs for anyone using pro/xtheme

Hello @eyedia,

Regretfully the given credentials are not working for us. Please double check it. Meanwhile, you may need to update your block of PHP code:

 function my_theme_wrapper_start() {
  echo '<div class="x-container max width offset sensei-custom-wrapper">
    	<div class="x-main left" role="main">';
}

function my_theme_wrapper_end() {
  get_sidebar();
  echo '</div>';
}

Please let us know how it goes.

I reset the password so it should now work.

I tried your code but it didn’t seam to help the single course page. The lesson pages also went strange when i replaced the code. I set it back to what i had before. Here is a screenshot of what happened with the lessons page with that code: https://imgur.com/a/89K8ika

Thank you

Hello @eyedia,

I have logged in and inspected your LMS pages. I noticed that it is broken missing a few closing tags. So I went ahead and updated your code:

function my_theme_wrapper_end() {

  if ( is_singular( 'course' ) ) {
  	echo '</div></div></div>';
  } else {
  	echo '</div>';
  }
	
  get_sidebar();
  echo '</div>';
}

The pages now seems fixed. Please double check your courses, lessons, and other pages related to LMS.

Wonderful! All is working perfectly now!
Thank you very much!

We are delighted to assist you with this.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.