I need to order my posts by alphabetical for each letter. I mean:
When people enter to www.xxx.com/a, they will just see posts by starting A.
ABC XYZ
ADE KLM
ARE UYZ
When people enter to www.xxx.com/b, they will just see posts by starting B.
BCK OIO
BHJ PEP
I hope you will understand what I want. I have founded this code:
<?php
$last_char = '';
$args=array(
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page'=>-1,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'Alphabetic index of all ' . count($my_query->posts) . ' posts';
while ($my_query->have_posts()) : $my_query->the_post();
$this_char = strtoupper(substr($post->post_title,0,1));
if ($this_char != $last_char) {
$last_char = $this_char;
echo '<h2>'.$last_char.'</h2>';
} ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
} //if ($my_query)
wp_reset_query(); // Restore global post data stomped by the_post().
?>
However, this code lists all posts by alphabetical in one page. As I said before, I just want same thing but for one letter which I specify.
Thank you for helping me.