Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Last active December 12, 2016 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasplevy/4521283c04f9ce1a96cdb11278e8dad4 to your computer and use it in GitHub Desktop.
Save thomasplevy/4521283c04f9ce1a96cdb11278e8dad4 to your computer and use it in GitHub Desktop.
Add layout options for LifterLMS courses, lessons, and quizzes for the Tesseract theme
<?php // don't copy this line into your functions.php file!
/**
* Add layout options for LifterLMS courses, lessons, and quizzes for the Tesseract theme
* @param string $layout default layout according to customizer options
* @return string
*/
function llms_tesseract_layout( $layout ) {
$post_type = get_post_type();
if ( is_singular() ) {
if ( 'course' === $post_type || 'lesson' === $post_type ) {
// $layout = 'sidebar-left'; // for left-side sidebars
$layout = 'sidebar-right'; // for right-side sidebars
} elseif ( 'llms_quiz' === $post_type ) {
$layout = 'fullwidth';
}
}
return $layout;
}
add_filter( 'theme_mod_tesseract_blog_post_layout', 'llms_tesseract_layout', 10, 1 );
/**
* Declare explicit theme support for LifterLMS course and lesson sidebars
* @return void
*/
function my_llms_theme_support(){
add_theme_support( 'lifterlms-sidebars' );
}
add_action( 'after_setup_theme', 'my_llms_theme_support' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment