Skip to content

Instantly share code, notes, and snippets.

@danjjohnson
Last active May 17, 2016 06:29
Show Gist options
  • Save danjjohnson/11483f140ba6014c63c7 to your computer and use it in GitHub Desktop.
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
<?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 );
?>
@danjjohnson
Copy link
Author

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.

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