HarunRRayhan

Change LearnDash CourseGrid Template Path

Aug 20th, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. /**
  2.  * OverWrite LearnDash Course Grid (Single Course) Template
  3.  * Removed default filter
  4.  * Added new filter
  5.  *
  6.  *
  7.  * @author HarunRRayhan
  8.  */
  9. if ( has_filter( 'learndash_template') ){
  10.     remove_filter( 'learndash_template', 'learndash_course_grid_course_list', 99 );  // Remove default course grid list template filter
  11.     add_filter( 'learndash_template', 'bg_learndash_course_grid_course_list', 99, 5); // Add our course grid list template
  12.  
  13.    
  14. }
  15. // Course Grid Template path
  16. function bg_learndash_course_grid_course_list($filepath, $name, $args, $echo, $return_file_path) {
  17.     if ( $name == "course_list_template" && $filepath == LEARNDASH_LMS_PLUGIN_DIR . 'templates/course_list_template.php' ) {
  18.         return dirname(__FILE__) . "/course-grid/course_list_template.php";
  19.     }
  20.  
  21.     return $filepath;
  22. }
Add Comment
Please, Sign In to add comment