Specifying Your Own Wrappers

You must first complete Content Wrappers – The Basics before viewing this Lesson

First you need to find the correct HTML structure for the wrappers.

You can find the correct HTML structure in your theme by opening your theme’s page.php file, and looking for your theme’s container divs.

In this case, these are the HTML divs before and after your post’s content loop that displays the page content.

Wrappers Example: TwentyTen Theme

By default, the Sensei wrappers don’t work well with the TwentyTen theme (don’t worry, if you want to use it, this example will show you how!)

For example, if you look at a single quiz page, you can see how the sidebar is being pushed down below the main content:

 

If you look at the page.php file for the TwentyTen theme, you can see the HTML that is placed around the content loop, as shown:

 

The opening wrappers are the two opening divs above the main content loop, and the closing wrappers are the corresponding closing divs below the loop. You also need to include the get_sidebar function which will output the sidebar on your Sensei pages.

[highlight]Note: If your theme’s page.php file is much more complex than this and you can’t easily tell what the opening and closing wrappers would be, you may need to get a developer to help you figure it out. We recommend Codeable or one of our WooExperts[/highlight]

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:

Now hook in your own functions, which specify the correct start and end wrappers for the theme. Add this to the end of the functions.php file:

Now if you view the quiz page again, you’ll see that the sidebar is on the side where it’s supposed to be. Result!

Pagination Wrappers

Prior to version 1.1.0, Sensei used the standard WordPress pagination functions to navigate between courses, lessons, and quizzes. However, we’ve improved this by updating the pagination functions to display the next Course, Lesson, and Quiz, taking into account the order settings and the pre-requisite settings. The files that are used to accomplish this are

templates/globals/pagination-lesson.php – loads pagination for lessons.
templates/globals/pagination-posts.php – loads default pagination for courses.
templates/globals/pagination-quiz.php – loads pagination for quizzes.

Back to: Sensei and Theme Integration > Basic Integration