WordPress.org

Support

Support » How-To and Troubleshooting » Is there a way to display posts by alphabet?

Is there a way to display posts by alphabet?

  • Monkeyboy
    Member

    @monkeyboy

    Is there a way to display posts by alphabet? I understand it’s possible to order posts by name, either ascending or descending, but suppose I just want to display posts from a certain category, but only those beginning with the letter A, or letter B and so on. Is it possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • If you are just want to get a sub-set of posts in category 4, where the title begins with A or B then this might work (didn’t test this):

    <?php
      function filter_where($where = '') {
        $where .= " AND post_title >= 'A' AND post_title < 'C'";
        return $where;
      }
    add_filter('posts_where', 'filter_where');
    query_posts($query_string . '&cat=4');
    ?>

    Hi,

    Yes, it is possible to display post in alphabetically but for that you have to modify the code inside the index.php file of your blog theme folder..

    [spam link removed]

    Thanks,

    Shane G.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is there a way to display posts by alphabet?’ is closed to new replies.