Skip to content

Instantly share code, notes, and snippets.

@thomasplevy
Last active November 4, 2016 19:57
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/682f619c6a396e14639dbe11814a5b00 to your computer and use it in GitHub Desktop.
Save thomasplevy/682f619c6a396e14639dbe11814a5b00 to your computer and use it in GitHub Desktop.
<?php // don't copy this line to your functions.php file
/**
* Customize the number of columns displayed on LifterLMS Course and Membership Catalogs
* Note that LifterLMS has native support for 1 - 6 columns
* If you require 7 or more columns you will need to write custom CSS to accommodate
* @param int $cols default number of columns (3)
* @return int
*/
function my_llms_loop_cols( $cols ) {
return 2; // change this to be the number of columns you want
}
add_filter( 'lifterlms_loop_columns', 'my_llms_loop_cols' );
<?php // don't copy this line to your functions.php file
/**
* Customize the number of columns displayed on LifterLMS Course and Membership Catalogs
* Note that LifterLMS has native support for 1 - 6 columns
* If you require 7 or more columns you will need to write custom CSS to accommodate
*
* This version displays a different number of columns on Course & Membership Catalogs
*
* @param int $cols default number of columns (3)
* @return int
*/
function my_llms_loop_cols( $cols ) {
if ( is_post_type_archive( 'course' ) ) {
return 4;
} elseif ( is_post_type_archive( 'llms_membership' ) ) {
return 2;
}
return $cols;
}
add_filter( 'lifterlms_loop_columns', 'my_llms_loop_cols' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment