Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active March 2, 2023 18:29
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 braddalton/acd40ad6c81d545c631e0db49ce9db5a to your computer and use it in GitHub Desktop.
Save braddalton/acd40ad6c81d545c631e0db49ce9db5a to your computer and use it in GitHub Desktop.
Add Pagination to AgentPress Pro Listings Archive Page https://wpsites.net/?p=111827
<?php // Do NOT copy this opening PHP tag. Code goes at end of functions.php
add_action( 'pre_get_posts', 'agentpress_pro_listings_pagination', 10 );
function agentpress_pro_listings_pagination( $query ) {
if ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'listing' ) ) {
$query->set( 'posts_per_page', 12 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment