• Hi, I need some code to put in my sidebar wich will list all the posts on my blog a-z, not limited by category etc.

    thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php
        $args=array(
          'orderby' => 'title',
          'order' => 'asc',
          'post_type' => 'post',
          '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 'Alpha List of All Posts';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
          endwhile;
        }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
    Thread Starter jamiedustuk

    (@jamiedustuk)

    great! thats just what I needed, thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display all posts a-z’ is closed to new replies.