Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Last active November 16, 2016 01:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasplevy/795fd98f3073e6872fc36f28e30d05ec to your computer and use it in GitHub Desktop.
Save thomasplevy/795fd98f3073e6872fc36f28e30d05ec to your computer and use it in GitHub Desktop.
<?php // don't add this line to your functions.php file
/**
* 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' );
<?php // don't add this line to your functions.php file
/**
* Display LifterLMS Course and Lesson sidebars
* on courses and lessons in place of the sidebar returned by
* this function
* @param string $id default sidebar id (an empty string)
* @return string
*/
function my_llms_sidebar_function( $id ) {
$my_sidebar_id = 'my-sidebar-id'; // replace this with your theme's sidebar ID
return $my_sidebar_id;
}
add_filter( 'llms_get_theme_default_sidebar', 'my_llms_sidebar_function' );
@mneuschaefer
Copy link

semicolon missing in line 13

@thomasplevy
Copy link
Author

thanks

@cclambie
Copy link

Thomas, I suggest you spell out the need for the full words of the # to be in inside the single quotes in
https://gist.github.com/thomasplevy/795fd98f3073e6872fc36f28e30d05ec#file-llms-sidebar-support-php

I just spent 15 minutes trying to figure out why this wasn't working, as I just put '1', instead of 'sidebar-1' in the quotes.
Might help someone in the future.

I suggest updating line 11 to
$my_sidebar_id = 'my-sidebar-id'; // replace this with your theme's sidebar ID eg. 'sidebar-1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment