Skip to content

Instantly share code, notes, and snippets.

@merli129
Last active February 17, 2017 17:54
Show Gist options
  • Select an option

  • Save merli129/babf0dc8dd851017499346aba2433712 to your computer and use it in GitHub Desktop.

Select an option

Save merli129/babf0dc8dd851017499346aba2433712 to your computer and use it in GitHub Desktop.
WordPress query_posts
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>
<!--Another version-->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- post -->
<?php endwhile; ?>
<!-- post navigation -->
<?php else: ?>
<!-- no posts found -->
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment