
In this article I am showing how to filter the posts by alphabet. Follow the steps at below.
Step 1:
Creating the custom rewrite rule, adding the two new query vars, write a where clause filter and saving the alphabets in array. Open your functions.php file and just drop the following PHP scripts.
Now save the functions.php file and upload it on your server. Next login to Dashboard and flush the permalink structure from Dashboard -> Settings -> Permalinks page. This step is completed.
Step 2:
Creating a template file like page_fba.php and put it in child theme folder. Now open the file and add the following snippets:
Step 3:
Adding some CSS codes in style.css file. Open your child theme’s style.css file and add the following code:
Step 4:
This is the last and final step.
- Navigate to Dashboard -> Pages -> Add New page
- Enter the page title
- Keep entry content blank
- Select the “Filter by Alphabets” template from Page Attributes -> Templates drop down list
- Hit on Publish button and live the page
- Click on “view page” link and see the output
If you need any help then you can feel free contact me.
Leave A Reply