All of the code snippets for modifying existing features can be found below. Check out this link if you do not know where to add custom code snipeets to your site.

Change Default Order Status For Ofline Payment

add_filter( 'masteriyo_offline_process_payment_order_status', function( $status ) {
    return 'completed';
});
add_filter( 'masteriyo_pro_course_featured_text', function( $text ) {
    return 'New Featured';
});

Sort the courses in the courses page alphabetically by course name.

add_filter( 'pre_get_posts', function ($q) {
	// We only want to affect the main query.
	if ( $q->is_main_query() && is_post_type_archive( 'mto-course' ) ) {
		$q->set( 'orderby', 'title ID');
		$q->set( 'order', 'ASC'); // ASC for A->Z or DESC for Z->A.;
	}
});

Sort the courses in the courses page according to published date.

add_filter( 'pre_get_posts', function ($q) {
	// We only want to affect the main query.
	if ( $q->is_main_query() && is_post_type_archive( 'mto-course' ) ) {
		$q->set( 'orderby', 'date ID');
		$q->set( 'order', 'DESC'); // ASC for Oldest->Newswet or DESC for Newest->Oldest
	}
});

Sort the courses in the courses page according to modified date.

add_filter( 'pre_get_posts', function ($q) {
	// We only want to affect the main query.
	if ( $q->is_main_query() && is_post_type_archive( 'mto-course' ) ) {
		$q->set( 'orderby', 'modified ID');
		$q->set( 'order', 'DESC'); // ASC for Oldest->Newswet or DESC for Newest->Oldest
	}
});

Was this article helpful to you?
Give us Rating

Last edited on February 01, 2023.
Edit this page