Skip to content

Instantly share code, notes, and snippets.

@kevinwhoffman
Last active April 8, 2022 11:22
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save kevinwhoffman/97c0f6c4be117fb389e9 to your computer and use it in GitHub Desktop.
Save kevinwhoffman/97c0f6c4be117fb389e9 to your computer and use it in GitHub Desktop.
WordPress - Custom Post Type Loop
<?php
$loop = new WP_Query( array(
'post_type' => 'Property',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<!-- do stuff -->
<?php endwhile; wp_reset_query(); ?>
@isaacdanielanderson
Copy link

Thanks!

@RichardLindhout
Copy link

Nice and clean!

@isandipanmondal
Copy link

Thank you very much

@rickydamarsaputra
Copy link

Terima Kasih

@aronmoshe-m
Copy link

Super clean. Thank you!

@adoubleyoueye
Copy link

Exactly what I need. Thank you!

@StevenCrocker
Copy link

don't forget 'post_status' => 'publish' so it only returns published posts

@Sean-Spallen
Copy link

Awesome thanks!

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