https://forums.modx.com/thread/?thread=100558
https://forums.modx.com/thread/100558/adding-a-sortby-old-new-dropdown-for-articles#dis-post-543393
I am trying to add a sortby dropdown option for my articles.
The option to select the order of display is in the advanced tab section but i'd like to provide that option in the front end.
Allowing users select what order they'd like to see. (Newest/Oldest).
I tried this -
<li><a href="[[~[[*id]]? &sortby=`ASC`]]">Newest</a></li>
<li><a href="[[~[[*id]]? &sortby=`DESC`]]">Oldest</a></li>
That didnt work.
Any suggestions/solutions will be welcomed]]>[email protected]Jul 19, 2016, 11:15 AMhttps://forums.modx.com/thread/100558/adding-a-sortby-old-new-dropdown-for-articles#dis-post-543393
https://forums.modx.com/thread/100558/adding-a-sortby-old-new-dropdown-for-articles#dis-post-543403
In the getResources tag:
&sortby=[[!GetSortBy]]
Then a custom snippet:
/*GetSortBy snippet */
return $_GET['sortby'];
Also, your tags above are incorrect (you can tell by looking at the URL, which should have ? &sortby=`ASC` at the end). The parameter goes inside the link tag with no question mark: