Compatibility with Sensei plugin

Hey guys,

We are using the Woo Sensei plugin. In their documentation it states:

For the most part, Sensei templates will integrate nicely with most WordPress themes.

Where you may run into problems is when the default Sensei content wrappers do not match those of your chosen theme. This is because Sensei pages use templates of their own, and it’s impossible for Sensei to know exactly what markup your theme uses.

This will manifest itself by breaking your layout on Sensei pages and shifting your sidebars into incorrect positions.

So, to make this theme work with Sensei, you need to unhook the default wrappers, and then hook in your own functions to specify the wrappers for this theme.

To unhook the default Sensei wrappers, add the following code to the end of the functions.php file in the theme:

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 );

After unhooking their wrappers, I have added the following hooks & function as it states in their docs to specify our [BB] wrappers:

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=“fl-archive container”><div class=“row”><div class=“fl-content fl-content-left col-md-8”>’;
}

function my_theme_wrapper_end() {
echo ‘</div><!-- #fl-content fl-content-left col-md-8–>
</div><!-- #row–>
</div><!-- #fl-archive container–>’;
get_sidebar();
}

This puts the Sensei content in the correct container, but I’m still getting the Sidebar misplaced > after the content: http://www.skoleflink.net/course/matematikk-5-klasse/

Can you please advise as to how we can get the Sidebar back into the correct location based on the information I’ve provided?

Thank you,
Kevin

Hi Kevin,

Unfortunately, I don’t have access to the Sensei plugin so I am not able to give a proper investigation. However, from reviewing your site, the sidebar is outside the <div class=“row”>…</div> container. If you can place the sidebar inside this, it should resolve your issue.

To demonstrate this, I have just this moment dragged your sidebar div inside the the row div and your layout displays as intended.

Cloudup

Have a play around with the hooks again and let us know if this helps.

Thanks,
Danny