Skip to content

Instantly share code, notes, and snippets.

@uncatcrea
Created December 11, 2015 13:10
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 uncatcrea/5f18ebc1dcb973217d24 to your computer and use it in GitHub Desktop.
Save uncatcrea/5f18ebc1dcb973217d24 to your computer and use it in GitHub Desktop.
Modify the default number of posts displayed in a list
add_filter( 'wpak_posts_list_posts_per_page', 'wpak_set_nb_posts', 10, 2 );
function wpak_set_nb_posts( $nb_items, $component ) {
//Check component slug to apply only to some of the "post list" components:
//(don't do this check to apply to all "post list" components)
if ( $component->slug === 'my-component-slug' ) {
$nb_items = 100; //Post number you want
}
return $nb_items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment