Support » Plugins and Hacks » List posts by taxonomy tag, in reverse order?

List posts by taxonomy tag, in reverse order?

  • Ian


    I’m using a slightly modified version of the code from this post (closed thread or I’d ask there): http://wordpress.org/support/topic/list-posts-by-taxonomy-tag?replies=8

    Here’s my code, from my sidebar:

    $post_type = 'portfolio';
    $tax = 'portfolio-date-of-project';
    $tax_terms = get_terms($tax,'hide_empty=0');
    //list everything
    if ($tax_terms) {
      foreach ($tax_terms  as $tax_term) {
          'post_type' => $post_type,
          'suppress_filters' => true,
          "$tax" => $tax_term->slug,
          'post_status' => 'publish',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo "<h2 class=\"tax_term-heading\" id=\"".$tax_term->slug."\"> $tax_term->name </h2><ul>";
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?> - <?php echo get_the_term_list( $post->ID, 'medium'); ?></a></li>
    echo "</ul>";

    I’m having a few problems.

    First, I’d like to show this list in REVERSE order, since the tags are actually dates, like “2009” and I want the latest date to show at the top.

    Second, the code doesn’t seem to be showing on my category archives:
    http://www.ianaleksanderadams.com/blog/ for example.

    I also want to put these in drop downs, but I think I can figure out that formatting once I get some help with those issues. I tried putting in that supress code above, but I’m not sure what else will help them show up in the categories.

  • The topic ‘List posts by taxonomy tag, in reverse order?’ is closed to new replies.