Hello beautiful peoples!
I was trying to display my posts in a specific category and in a specific order. I’ve figured out a method to do that and more using a URL.
Here is how: add ?orderby=date&order=ASC
to the end of Your URL.
Example:
Gimp category (by default sorted in order newest to oldest).
https://andrzej.langow.ski/category/application/gimp/
and Gimp category sorted in order oldest to newest.
https://andrzej.langow.ski/category/application/gimp/?orderby=date&order=ASC
There are more parameters that can be used with ?orderby=
in WordPress. Here are some of the most commonly used parameters and their functions:
date:
Sorts the posts by date.title:
Sorts the posts alphabetically by title.modified:
Sorts the posts by the date they were last modified.rand:
Sorts the posts randomly.comment_count:
Sorts the posts by the number of comments they have.
You can also use multiple parameters to sort the posts by multiple criteria. For example, if you want to sort the posts by date and title, you can use ?orderby=date title
.
I hope this helps!
Catch you on the flip side,
AndrzejL