Last active
December 12, 2016 23:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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