Skip to content

Instantly share code, notes, and snippets.

@kevinwhoffman
Last active July 17, 2024 14:47
Show Gist options
  • 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