Get all posts starting with an alphabet in wordpress

I’m trying to create directory listing in which at the top there will be links…from a-z
some what like this:

A B C D E ……………V W X Y Z

Read More

When a user presses on A, all the posts with titles starting with A should come, whats the best approach to achieve this?

Related posts

Leave a Reply

2 comments

  1. You have to implement an SQL request that would use the “LIKE” filter:

    SELECT * from post WHERE post.title LIKE 'A%';
    

    This request will give you all the posts starting with the ‘A’ letter.