WordPress.org

Ready to get started?Download WordPress

Forums

Is there a way to display posts by alphabet? (3 posts)

  1. Monkeyboy
    Member
    Posted 5 years ago #

    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?

  2. MichaelH
    Member
    Posted 5 years ago #

    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');
    ?>
  3. Shane G
    Member
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic