Hello, I am using custom post types and I am pulling the title of each post type to a specific landing page (each title is a link to that custom post page).
However, I would like the list to display alphabetically (not by date which it is currently set by).
This is the code I am currently using:
<ul class="sidenav1"> <?php $loop = new WP_Query( array( 'post_type' => 'locations') ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <li><?php the_title( '<a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a>'); ?></li> <?php endwhile; ?> </ul>
Any help would be appreciated – Thanks.
- The topic ‘Getting custom posts to display alphabetically’ is closed to new replies.