Ascending order in Post Slider
I have set the order by "Date" for my Post Slider. But how do I change the order to Ascending instead of descending?
I assume it is to be set in the PHP but would you give me some advice on how?
Thanks!
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Dmytro Semenov on 24 Apr, 2020 04:47 PM
Hello,
yes, you'll need to use php filter http://help.dimsemenov.com/kb/wordpress-royalslider-advanced/wp-mod...
https://developer.wordpress.org/reference/classes/wp_query/#order-o...
2 Posted by kevinfung.imi on 23 Jan, 2022 08:30 PM
Hi Dmitry,
I'm again trying to sort post by date in an ascending order in Royal Slider, but it is not working. I added exactly this to function.php :
// royalslider Add ASC order
function newrs_custom_query($args, $index) {
$args['order'] = 'ASC';
return $args;
}
add_filter('new_royalslider_posts_slider_query_args', 'newrs_custom_query', 3);
The slider ID is 3. I cleared cache and go back to RS and there is no change. Sorry I'm not really a coder and don't fully understand php filter. I may need more instructions...
Support Staff 3 Posted by Dmytro Semenov on 24 Jan, 2022 06:18 PM
The code looks correct. It'll apply only on the frontend (when embedded on some page), are you testing on the actual website?
You can try some other parameters just to test, for example: