Created
May 7, 2015 11:34
-
-
Save philippkuehn/ca2d375841c585e89338 to your computer and use it in GitHub Desktop.
search a custom post type page
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
<?php | |
$args = array( | |
'posts_per_page' => 10, | |
'post_type' => 'your_custom_post_type', | |
'post_status' => 'publish', | |
's' => get_search_query() | |
); | |
$query = new WP_Query($args); | |
if ($query->have_posts()) : | |
while ($query->have_posts()) : $query->the_post(); | |
// loop | |
endwhile; | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment