WordPress.org

Ready to get started?Download WordPress

Forums

WP_Query help adding in sort titles in assending order (1 post)

  1. Suffetyb
    Member
    Posted 2 years ago #

    I want to display posts from a category called "Shows" and I want to sort the titles (which are in the format: 04/15/2012, 04/19/2012, 05/04/2012) in ascending order. I can get it to sort the category and I can get it to sort in ascending order but when I try both I get an error. I also need the posts to be limited to 5.

    I'd appreciate any help.

    This is what my code looks like

    <ul id="sidebar" class="column colblue equalize">

  2. <h2 class="right">Shows</h2>
      <?php $my_query = new WP_Query('category_name=shows&posts_per_page=5'); ?>
      <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
      <!-- Do shows stuff... -->

    • <h3>" title="<?php the_title(); ?>"><?php the_title(); ?></h3>

      <?php the_meta(); ?>

      <div class="itementry">
      <?php the_content(__('Read more', 'hour24band')); ?>
      </div>

    • <?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags