Sensei Theming ↑ Back to Top
A comprehensive guide to theming in Sensei.
Sensei’s templating system is simple for developers to understand and to customize in their theme.
In the root of the plugin there is a folder called /templates/ - this is the folder that contains all the output html for Sensei on the frontend.
Course Archives ↑ Back to Top
The course archive page is handled by the following files:
These files will output the four main shortcodes to display “New Courses,” “Featured Courses,” “Paid Courses,” and “Free Courses.”
These shortcodes are:
[newcourses] - displays the latest courses
[featuredcourses] - displays the courses marked as featured
[freecourses] - displays courses that do not require payment to take
[paidcourses] - displays courses that require payment to take
The lesson archive page is handled by the following files:
These files will display a simple archive list of all lessons that have been created. It uses loop-lesson.php to output the lesson.
Single Course ↑ Back to Top
The individual course page is handled by the following files:
These files will output the individual course and its contents. The relevant functions that the files make use of are:
sensei_course_image - loads the course image.
sensei_course_single_title - loads the course title.
sensei_course_single_meta - loads the output from the file /single-course/course-meta.php - which shows the stage of completion of the course, as well as the course video is it is present. It will also display the prerequisite course link if applicable.
sensei_course_single_lessons - loads the output from the file /single-course/course-lesson.php - which shows a list of all the lessons that are part of the course as well as if they are complete or not.
sensei_pagination - loads the course pagination.
Single Lesson ↑ Back to Top
The individual lesson page is handled by the following files:
These files will output the individual lesson and a link to the lesson quiz. The relevant functions that the files make use of are:
sensei_comments - loads lesson comments.
sensei_lesson_image - loads the lessons image.
sensei_lesson_single_title - loads the lessons title.
sensei_lesson_single_meta() - loads the output from the file /single-lesson/lesson-meta.php - displays the prerequisite lesson if applicable, and a link to the lesson quiz if a quiz exists.
sensei_pagination hook - loads the lesson pagination.
Single Quiz ↑ Back to Top
The individual quiz page is handled by the following files:
- /single-quiz/question_type-boolean.php (True/False questions)
- /single-quiz/question_type-essay-paste.php (Essay questions)
- /single-quiz/question_type-gap-fill.php (Gap Fill questions)
- /single-quiz/question_type-multi-line.php (Multi Line questions)
- /single-quiz/question_type-multiple-choice.php (Multiple Choice questions)
- /single-quiz/question_type-single-line.php (Single Line questions)
These files will output the lessons quiz questions and handle submission of the users question answers. The relevant functions that the files make use of are:
sensei_quiz_single_title - loads the quiz title.
sensei_quiz_questions - loads the output from the file /single-quiz/quiz-questions.php - displays the list of quiz questions and handle the submission of the users question answers. quiz-questions.php loads each template file for each type of question as per the list above.
sensei_pagination - loads the quiz pagination.
Learner Profiles ↑ Back to Top
The learner profile pages are handled by these template files:
These files handle the display of the learner profiles. The relevant functions that the files make use of are:
load_user_courses_content – This handles the display of the user’s courses.
Course Results ↑ Back to Top
The course results page is handled by these template files:
These files handle the display of the course results. The relevant functions that the files make use of are:
sensei_course_image - loads the course image.
sensei_course_single_title - loads the course title.
Course Categories ↑ Back to Top
Since version 1.1.0 of Sensei we’ve added the ability to categorize your Courses with a new taxonomy called “Course Categories”. The template file that is used is taxonomy-course-category.php - in addition we’ve added the category meta information wherever the original course meta information is output.
My Account ↑ Back to Top
The My Account page will show a list of the users Active Courses as well as their Completed Courses. The template file that is used is /user/my-courses.php
WooCommerce ↑ Back to Top
If WooCommerce has been enabled and Courses are linked up to a WooCommerce Product, the “Add to Cart” button is handled by the file in /woocommerce/add-to-cart.php
Access Errors ↑ Back to Top
If a user does not have access to a specific area of the Course, Lesson, or Quiz, the output will be handled by no-permissions.php - this fille will load content-no-permissions.php to display the relevant error message.
Hooks ↑ Back to Top
If you dont want to modify Sensei’s layouts and structure and just want to inject information around the content, we have added the following hooks for developers to make use of:
sensei_before_main_content - runs before the loop
sensei_after_main_content - runs after the loop
sensei_pagination - runs after main content
sensei_comments - only runs on the lesson single page after main content
sensei_sidebar - runs on every single/archive sensei page
sensei_course_single_meta - this runs on the single course page and outputs the meta information for the course.
sensei_course_single_lessons - this runs on the single course page and outputs the list of lessons within the course.
sensei_frontend_messages - this runs on the single lesson and quiz pages and outputs the access permissions messages. Use this when making use of the access permissions filter to output your own messages.
sensei_lesson_single_meta - runs on the single lesson page and outputs the meta information for the lesson.
sensei_quiz_questions - runs after the content on the single quiz page and outputs the quiz questions and answers.
sensei_course_single_title - runs after the course image on the single course page and outputs the course title.
sensei_lesson_single_title - runs after the lesson image on the single lesson page and outputs the lesson title.
sensei_quiz_single_title - runs on the single quiz page and outputs the quiz title.
sensei_quiz_question_type - runs on single quiz page and outputs the actual question type markup.
sensei_quiz_action_buttons - runs on the single quiz page and outputs the quiz complete, save, and reset buttons.
sensei_course_image - runs on all pages that output the course image, including the single course page, course archives, my courses, and in the course widgets – it usually runs just before the course title.
sensei_lesson_image - runs on all pages that output the lesson image, including the single course page, single lesson page, lesson archives, and in the lesson widgets – it usually runs just before the lesson title.
sensei_course_archive_header - runs on the course archive pages and course category archive pages, outputting the header title.
sensei_course_archive_course_title - runs after the course image on the course archive pages, outputting the course title.
sensei_course_archive_course_meta - runs after the course title on the course archive pages, outputting the course meta.
sensei_before_user_courses – runs before a user’s courses are outputted.
sensei_before_active_user_courses - runs when a user’s courses are outputted, specifically before the active courses.
sensei_after_active_user_courses - runs when a user’s courses are outputted, specifically after the active courses.
sensei_before_completed_user_courses - runs when a user’s courses are outputted, specifically before the completed courses.
sensei_after_completed_user_courses - runs when a user’s courses are outputted, specifically after the completed courses.
sensei_after_user_courses - runs after a user’s courses are outputted.
sensei_course_results_content - outputs the course results page content.
sensei_course_results_info – outputs the course results page info.
sensei_course_results_before_lessons - runs on the course results page before each course’s lessons are displayed.
sensei_course_results_after_lessons - runs on the course results page after each course’s lessons are displayed.
sensei_course_results_top – runs on the course results page before each course is displayed.
sensei_course_image - runs on the course results page before the title and displays the course image.
sensei_course_results_lessons - runs on the course results page after each course is displayed and displays all courses in the lesson.
sensei_course_results_bottom - runs on the course results page after each course is displayed.
sensei_learner_profile_content - outputs the learner profile page content.
sensei_learner_profile_info - outputs the learner profile page info.
sensei_before_learner_course_content – runs before the course content is displayed on learner profiles.
sensei_after_learner_course_content - runs after the course content is displayed on learner profiles.
sensei_user_lesson_start - runs when a user starts a lesson.
sensei_user_lesson_end - runs when a user completes a lesson.
sensei_user_course_start - runs when a user starts a course.
sensei_user_course_end - runs when a user completes a course.
sensei_user_quiz_grade - runs when a quizzes grade is saved.
sensei_additional_styles – runs after Sensei styles are loaded – allows extensions to load addtional stylesheets
Filters ↑ Back to Top
If you would like to change the text that Sensei displays or modify some of the other features of Sensei, we have added the following filters for developers to make use of:
Menu Item Filters
sensei_course_page_menu_link – modifies the link HTML for the course archive page
sensei_lesson_archive_page_menu_link - modifies the link HTML for the lessons archive page
sensei_my_account_page_menu_link - modifies the link HTML for the my courses page
sensei_logout_menu_link - modifies the link HTML for the logout link
sensei_login_menu_link - modifies the link HTML for the login link
sensei_custom_menu_links - modifies all the links HTML for the menu
sensei_learner_profile_menu_link – modifies the link HTML or the learner profile link
course_category_archive_title – modifies the course category taxonomy archive title html
course_archive_title – modifies the course archive title html
lesson_archive_title - modifies the lesson archive title html
course_archive_next_link – modifies the next link in the course archive pages
Custom Post Type & Custom Taxonomy Filters
sensei_course_slug - modifies the course post type url slug
sensei_lesson_slug - modifies the lesson post type url slug
sensei_quiz_slug - modifies the quiz post type url slug
sensei_question_slug - modifies the question post type url slug
sensei_course_category_slug - modifies the course category taxonomy url slug
sensei_quiz_type_slug - modifies the quiz type taxonomy url slug
sensei_question_type_slug - modifies the question type taxonomy url slug
sensei_lessons_text - modifies the label for ‘Lessons’ across the whole site
sensei_courses_text - modifies the label for ‘Courses’ across the whole site
sensei_my_courses_text - modifies the label for ‘My Courses’ in menu
sensei_logout_text - modifies the label for ‘Logout’ link in menu
sensei_login_text - modifies the label for ‘Login’ link in menu
sensei_learner_profile_menu_link_text - modifies the text for the learner profile link in the menu
sensei_start_course_text – modifies the label for the ‘Start taking this Course’ buttons
sensei_reset_lesson_text - modifies the label for the ‘Reset Lesson’ buttons
sensei_submitted_for_grading_text – modifies the ‘Submitted for Grading’ text in the Grading UI
sensei_graded_text - modifies the ‘Graded’ text in the Grading UI
sensei_in_progess_text - modifies the ‘In Progress’ text across the whole site
sensei_new_courses_text – modifies the ‘New Courses’ text across the whole site
sensei_featured_courses_text - modifies the ‘Featured Courses’ text across the whole site
sensei_free_courses_text - modifies the ‘Free Courses’ text across the whole site
sensei_paid_courses_text - modifies the ‘Paid Courses’ text across the whole site
sensei_lessons_archive_text - modifies the ‘Lessons Archive’ text across the whole site
sensei_back_to_course_text – modifies the ‘Back to the course’ link text
sensei_back_to_lesson_text - modifies the ‘Back to the lesson’ link text
sensei_please_purchase_course_text - modifies the ‘Please purchase the course before starting the Lesson’ text
sensei_please_sign_up_text - modifies the ‘Please sign up for the course before starting the Lesson’ text
sensei_sign_up_text – modifies the ‘Sign Up’ text across the whole site
sensei_complete_lesson_text - modifies the ‘Complete Lesson’ button text
sensei_reset_lesson_text - modifies the ‘Reset Lesson’ button text
sensei_lesson_reset_text - modifies the ‘Lesson Reset Successfully’ notification text
sensei_mark_as_complete_text - modifies the ‘Mark as Complete’ button text
sensei_delete_course_text - modifies the ‘Delete Course’ button text
sensei_complete_quiz_text - modifies the ‘Complete Quiz’ button text
sensei_save_quiz_text - modifies the ‘Save Quiz’ button text
sensei_reset_quiz_text - modifies the ‘Reset Quiz’ button text
sensei_quiz_saved_text - modifies the ‘Quiz Saved Successfully’ notification text
sensei_quiz_reset_text - modifies the ‘Quiz Reset Successfully’ notification text
sensei_view_lesson_quiz_text – modifies the ‘View the Lesson Quiz’ link text
sensei_view_course_text - modifies the ‘View course’ link text
sensei_view_results_text - modifies the ‘View results’ link text
sensei_complete_text - modifies the ‘Completed’ text across the whole site
sensei_lesson_placeholder_image_url – modifies the lesson placeholder image html
sensei_course_placeholder_image_url - modifies the course placeholder image html
sensei_placeholder_thumbnail - modifies the default placeholder image html
sensei_access_permissions - modifies the access permissions setting for each Sensei page
sensei_all_access – modified the global access permissions
Managing memberships ↑ Back to Top
If you would like to enable membership and subscription payments for your Sensei courses then you will need to install the following plugins along with Sensei:
- WooCommerce (free)
- WooCommerce Subscriptions (from $99)
- Sensei handles both Variable and Simple Subscriptions and allows you to assign a specific variation to a Course.
- Any changes to the Learners Subscriptions, for example Cancellations and Expirations, may be handled in future versions of Sensei but are not supported at this time.
- Since version 1.2.0 of Sensei, native support for Subscription signups have been added to the core.
- Cancellations of any WooCommerce order in the WordPress admin are supported, and they will remove the Courses in the order from the Learners account. This covers standard subscriptions, but not renewals of a subscription.
Theme integration ↑ Back to Top
Out of the box Sensei will work with your theme, however it is possible you will need to make changes to the markup or the structure of a Course, Lesson, etc, for display with your theme. All you need to do is make a folder called /sensei/ in your theme root. Please note that the folder name is case sensitive, so ensure that it is all lowercase. Then simply copy over the files and folders you need to edit, from the plugin’s /templates/ folder into your new /sensei/ folder (you don’t need to add the /templates/ folder to your theme). Then you can make your changes and the plugin will load the files from the theme first.
The body content of a Course, Lesson, or Quiz is wrapped by html, these wrappers are in the following files:
These wrappers handle the Twenty Eleven and Twenty Twelve themes by default and these wrappers will need to be modified if your theme has a different layout.
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
/wrappers/pagination-lesson.php - loads pagination for lessons.
/wrappers/pagination-posts.php - loads default pagination for courses.
/wrappers/pagination-quiz.php - loads pagination for quizzes.
Adjusting the Wrappers
When you first install Sensei, you may find the layout on the Sensei screens on your website are not quite right. Certain sections may be full width or your sidebar may be missing. To resolve this, you can adjust the HTML that wraps the content of these Sensei screens. These would then be replaced by the HTML structure used by your theme.
Wrappers Example: Canvas Theme
Your Lessons page may look like this upon installing the Sensei plugin:
Sensei content displaying full-width or not showing a sidebar or pushing the sidebar down below Sensei content, for example.
This can be resolved by overriding the wrapper files, which are located in the /wp-content/plugins/sensei/templates/wrappers/ folder on your website.
Inside your theme folder create a new folder titled sensei.
Inside the sensei folder, create a new folder titled wrappers.
Copy the following files from the plugin to that folder within your theme.
You will now need to find the correct HTML structure in your theme by opening your themes single.php or page.php and look for your themes container divs. In this case, these are the HTML divs before and after your posts content loop that displays the page content.
- Edit wrapper-start.php
- Add the code snippet here: http://snippi.com/s/xyyg4gj
- After editing the code it should look like this: http://cld.wthms.co/zIGy
- Edit wrapper-end.php
- Add the code snippet here: http://snippi.com/s/ixvrml3
- After editing the code it should look like this: http://cld.wthms.co/mOsP
- Your Lessons page should now look like this:
The ‘canvas’ part of the above code is the name of the folder your theme is within and will tell the wrappers only to load this code if that theme is activated and displaying on your site.
Each theme will be slightly different as will the themes container divs but this process will be the same for any WordPress theme you are using.