Last active
March 23, 2016 05:22
-
-
Save henryhu712/1edcb659cc9818ed7a94 to your computer and use it in GitHub Desktop.
Wordpress - Get all posts of a custom type 'campaign' #wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$loop = new WP_Query( array( | |
'post_type' => 'campaign', | |
'posts_per_page' => -1, // It will return all posts. | |
)); | |
while ( $loop->have_posts() ) { | |
$loop->the_post(); | |
$post_id = get_the_ID(); | |
$post_title = get_the_title(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment