Sort Posts on Category Page Alphabetically
-
I am attempting to do as the topic describes: on category pages display all the posts in that category on one page alphabetically (by title).
I am using the following code to do this currently:
<?php $postslist = get_posts('numberposts=100&order=ASC&orderby=post_title'); foreach ($postslist as $post) : start_wp(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> | <small> Posted on <?php the_time('M d Y');?> </small> </li> <?php endforeach; ?>
It works.. but the problem currently is that it creates empty lines for all the posts, including ones not in that category.
As that probably didn’t make much sense, see https://users.ice-berg.net/worldspinsmadlyon/?cat=3
What am I doing wrong currently?
Thanks in advance
- The topic ‘Sort Posts on Category Page Alphabetically’ is closed to new replies.