Content Wrappers – The Basics

Declaring Sensei Support in Your Theme

If you’re a theme author, and you’re happy that your theme is fully compatible with Sensei, you can declare Sensei support, by adding the following to your functions.php file:

From Sensei v1.6.6 onward, you will see a notice in your Dashboard if you’re using a theme that doesn’t declare Sensei support.

Content Wrappers

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. A content wrapper is an HTML element, usually a <div>, that encloses the actual content on a post or page. These wrapper elements are usually added to allow the theme developer finer control over the appearance of the content.

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

When this happens, you’ll need to add some code to your theme that tells Sensei what content wrappers your theme uses, so that the Sensei content gets added in the right place.

The default Sensei content wrappers are in the following files:

  • templates/globals/wrapper-start.php
  • templates/globals/wrapper-end.php

These wrappers will work for most well-built themes. We also provide custom wrappers for the following themes:

  • _s
  • Storefront
  • Twenty Eleven
  • Twenty Twelve
  • Twenty Thirteen
  • Twenty Fourteen
  • Twenty Fifteen
  • Twenty Sixteen

Note: The wrappers for these themes are stored in the /theme-integrations/ folder and will be loaded automatically if you are using one of those themes. If you’d prefer not to load the wrappers for these themes, and provide your own instead, you can prevent them from loading by adding the following code to your theme’s functions.php file:

add_filter( 'sensei_load_default_supported_theme_wrappers', '__return_false' );

If your theme uses a different structure, you’ll need to specify your own content wrappers by adding some code to your theme’s functions.php file or to a functionality plugin, such as Code Snippets. Learn how to do this in the next lesson!

Back to: Sensei and Theme Integration > Basic Integration