Skip to content

Instantly share code, notes, and snippets.

@carmolim
Last active July 24, 2018 22:29
Show Gist options
  • Save carmolim/3d24b324edb0b8ae499ff273470013d6 to your computer and use it in GitHub Desktop.
Save carmolim/3d24b324edb0b8ae499ff273470013d6 to your computer and use it in GitHub Desktop.
[alternate loop] #wordpress
<?php
$args = array(
'post_type' => 'projeto'
);
?>
<?php $the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment