Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SWP_Query Loop syntax
<?php
$swp_query = new SWP_Query( array( 's' => 'coffee' ) );
if ( $swp_query->have_posts() ) {
while ( $swp_query->have_posts() ) {
$swp_query->the_post();
get_template_part( 'content', 'search' );
}
} else {
echo '<p>No results found!</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.