Thread Starter
elavd
(@elavd)
Also, If I try to create my own Courses Archive using Elementor Pro (and set my custom sort ordering), it doesn’t work.
Elementor cannot override LearnPress archive page. Why is that?
Hi,
1. You can use this hook ‘lp/rest-api/frontend/course/archive_course/query_args’ and set 2 parameters $args[‘orderby’] & $args[‘order’]
This is the guide: https://developer.ww.wp.xz.cn/reference/classes/wp_query/#order-orderby-parameters
2. Currently, we don’t provide function allow edit the LearnPress archive page with the Elementor, we are develop a plugin to do that, it will available soon.
Thanks
With regard to your answer:
1. You can use this hook ‘lp/rest-api/frontend/course/archive_course/query_args’ and set 2 parameters $args[‘orderby’] & $args[‘order’]
This is the guide: https://developer.ww.wp.xz.cn/reference/classes/wp_query/#order-orderby-parameters
My Question is:
What is the file to edit for this? functions.php?
What is the exact format of the hook code that we should add to change the order display of the courses on the category/archive page?
Thread Starter
elavd
(@elavd)
1. You can use this hook ‘lp/rest-api/frontend/course/archive_course/query_args’ and set 2 parameters $args[‘orderby’] & $args[‘order’]
Thanks I’ll give it a try!
2. Currently, we don’t provide function allow edit the LearnPress archive page with the Elementor, we are develop a plugin to do that, it will available soon.
How soon?
Hi,
Of course, you need to push code to the functions.php file
This is the code to change
add_filter(
'lp/rest-api/frontend/course/archive_course/query_args',
function ( $args ) {
$args['orderby'] = 'title';
$args['order'] = 'DESC';
return $args;
},
11,
1
);