What you describe is the typical use case for a custom post type. When you register your post type, set the has_archive
argument to true
and WordPress will generate a custom post type archive page, which will be the list of all your property posts.
Normally, the number of property posts displayed will use your admin setting for Blog pages show at most
, located under Settings > Reading
, but you can override that to display all, no matter the number, via the pre_get_posts
action:
function property_posts_per_page( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( $query->is_post_type_archive( 'property' ) ) {
$query->set( 'posts_per_page', -1 );
}
}
add_action( 'pre_get_posts', 'property_posts_per_page' );