Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $my_query = new WP_Query( array('post_type'=>'page', 'orderby'=>'title', 'order'=>'ASC', 'posts_per_page'=>-1) );
- if ( $my_query ->have_posts() ):
- ?>
- <ul class="posts-list">
- <?php
- $found_posts = array();
- foreach ( $my_query->posts as $k=>$p ) {
- $found_posts[ apply_filters('the_title', $p->post_title) ] = $p;
- }
- ksort($found_posts);
- $i=0;
- foreach ($found_posts as $k=>$p) {
- $my_query->posts[$i++] = $p;
- }
- ?>
- <?php while ( $my_query->have_posts() ): $my_query->the_post(); ?>
- <li><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></li>
- <?php endwhile; ?>
- </ul>
- <?php endif; wp_reset_postdata(); ?>
Advertisement
Add Comment
Please, Sign In to add comment