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';
});
Want to know where and how to add code snippets? Check out this link
add_filter( 'masteriyo_pro_course_featured_text', function( $text ) {
    return 'New Featured';
});
Want to know where and how to add code snippets? Check out this link

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.;
	}
});
Want to know where and how to add code snippets? Check out this link

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
	}
});
Want to know where and how to add code snippets? Check out this link

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
	}
});
Want to know where and how to add code snippets? Check out this link

Multiple Coupon code support.

add_filter('masteriyo_enable_multiple_coupon', function($bool, $coupon_code) {
  return true;
});
Want to know where and how to add code snippets? Check out this link

Solution to Video Playback Fast-Forward or Rewind Function Not Working.

To ensure the security of your self-hosted videos, we provide various security codes. However, in certain cases, the hosting platform may clash with this security measure, making it impossible to forward or rewind the video by clicking on a specific time. In these scenarios, we suggest implementing the code snippet below to resolve the problem.

add_filter( 'masteriyo_self_hosted_lesson_video_url', function( $url, $lesson ) { 
$url = wp_get_attachment_url( $lesson->get_video_source_id() ); 
return $url; 
}, 10, 2);
Want to know where and how to add code snippets? Check out this link

Was this article helpful to you?
Give us Rating

Last edited on May 22, 2023.
Edit this page