Hi,
As this is a code needed to be inserted into the free JS, I suggest opening a ticket with our developer’s forum where they can instruct you where to apply the code and the following information needed –
https://github.com/elementor/elementor
Also, please have a look at the following –
https://developer.ww.wp.xz.cn/reference/classes/wp_query/
Thread Starter
xabdu
(@xabdu)
I did that just now, but I see there are many unanswered requests. It has been a few months, and nobody answered their requests.
https://github.com/elementor/elementor/discussions/18212
Hi,
Adding the code into elementor should be through the WP code.
Please have a look at the following guide to add it to your WP code –
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/
Thread Starter
xabdu
(@xabdu)
Thank you, but I need someone to help me to find the correct custom codes for the query filter.
Hi,
The issue, in this case, is that we will be handling the LMS content that may have different queries.
For example, the popularity (‘orderby’ => ‘comment_count’ ) is based on number of comments.
Since we do not know the LMS queries and how it works, we can’t write the code for you. Also, we are not the developers, that is why I suggested going to our GitHub since it is run by the developers.
The code should look similiar to this:
function popularity_order_courses( $query ) {
$query->set( ‘post_type’, ‘courses’ );
$query->set( ‘orderby’, ‘comment_count’ );
}
add_action( ‘elementor/query/{$query_id}’, ‘my_query_by_different_order’ );
add_action( ‘elementor/query/{$query_id}’, ‘popularity_order_courses’ );
But, since we do not know how exactly how you call your custom post types (courses), we can’t guarantee it will be 100% working.
The code should be used inside the functions.php of the child theme or as a custom plugin.
I hope this gives you more insight into the process you need to go through.