Skip to content

Instantly share code, notes, and snippets.

@mattbanks
Created August 5, 2014 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbanks/66cd8c6dcbbccb34189e to your computer and use it in GitHub Desktop.
Save mattbanks/66cd8c6dcbbccb34189e to your computer and use it in GitHub Desktop.
Awful loop usage in WordPress theme index.php
<?php global $wp_query;
query_posts(
array_merge(
$wp_query->query,
array(
'orderby' => 'post_date',
'order' => 'desc'
)
)
);
?>
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div class="blogEntry">
<div class="blogDate">
<span class="blogMonth"><?php the_time('F'); ?></span>
<span class="blogDay"><?php the_time('j'); ?></span>
</div>
<a href="<?php the_permalink(); ?>"><h1 class="balance-text"><?php the_title(); ?></h1></a>
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment