Last active
May 17, 2016 06:29
-
-
Save danjjohnson/11483f140ba6014c63c7 to your computer and use it in GitHub Desktop.
Sensei - Set number of lessons to show per page on a Module archive page
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 | |
function module_archive_limit( $query ) { | |
if( is_tax( Sensei()->modules->taxonomy ) && $query->is_main_query() ) { | |
// Set number of lessons per page | |
$query->set( 'posts_per_page', 20 ); | |
} | |
} | |
add_action( 'pre_get_posts', 'module_archive_limit', 15, 1 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the code above to your theme's functions.php file (without the opening and closing
<?php ?>
tags) and adjust the value (20) to set the number of lessons per page on Module archive pages.