I have seen on some websites that you can sort posts server-side by passing in some queries like so: domain.com/?sort=date
or domain.com/?sort=name
How would I do this with WordPress posts on a page?
I have seen on some websites that you can sort posts server-side by passing in some queries like so: domain.com/?sort=date
or domain.com/?sort=name
How would I do this with WordPress posts on a page?
You must be logged in to post a comment.
The display of posts is controlled by WordPress Loop. It has a lot of possible arguments, but they are rarely exposed in URL (especially if using pretty permalinks).
But it is possible to make use of arguments by manually adding them to URL.
For sorting see Orderby Parameters. Your example would be something like: