• Resolved InventiveWebDesign

    (@inventivewebdesign)


    I am using the Bridge theme by Qode which uses the WPBakery editor. I would like to have my users be able to choose how to sort our blog posts. They may want to see them by date or in alpha order. Is there a plugin or a way to have the option for users. Just a toggle or dropdown that allows them to sort by title ascending or descending or the same for by date?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    If you make the sort selection element a small form where the form tag action attribute is blank, submitting the form will just reload the current page. Now, if the form method is GET and the selection fields are named “orderby” and “order” and their values are “title” or “date”, and “asc” or “desc” respectively, submitting the form will make a request similar to:
    example.com/?orderby=title&order=asc

    As long as the current page is a post listing of some sort, WP will properly interpret the passed URL query string and serve results accordingly. Your form will need a “Go” button in order to submit the form. Or add some JavaScript to submit the form with the “onchange” event.

    Thread Starter InventiveWebDesign

    (@inventivewebdesign)

    So I can essentially have two buttons, one that links to example.com/?orderby=title&order=asc and another that links to example.com/?orderby=date&order=desc? and they would properly sort the listing page?

    Thread Starter InventiveWebDesign

    (@inventivewebdesign)

    Worked perfect… thank you!

    Moderator bcworkz

    (@bcworkz)

    You’re welcome!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Users able to sort posts in different ways’ is closed to new replies.