'lpSkeletonParam' ] ); ?> '
', 'wrapper_inner' => '
', 'skeleton' => $skeleton, 'wrapper_inner_end' => '
', 'wrapper_end' => '
', ], $data ); echo Template::combine_components( $sections ); } catch ( Throwable $e ) { error_log( __METHOD__ . ': ' . $e->getMessage() ); } } /** * Get instructor item. * * @param UserModel $instructor * * @return string */ public function instructor_item( UserModel $instructor ): string { $content = ''; try { $singleInstructorTemplate = SingleInstructorTemplate::instance(); $items = apply_filters( 'learn-press/list-instructors/instructor_item/sections', [ 'img' => $singleInstructorTemplate->html_avatar( $instructor ), 'name' => sprintf( '%s', $instructor->get_url_instructor(), $singleInstructorTemplate->html_display_name( $instructor ) ), 'info' => $this->instructor_item_info( $instructor ), 'btn_view' => $singleInstructorTemplate->html_button_view( $instructor ), ], $instructor, $singleInstructorTemplate ); $sections = apply_filters( 'learn-press/list-instructors/instructor_item/wrapper', [ 'wrapper' => '
  • ', 'content' => Template::combine_components( $items ), 'wrapper_end' => '
  • ', ], $instructor ); $content = Template::combine_components( $sections ); } catch ( Throwable $e ) { error_log( __METHOD__ . ': ' . $e->getMessage() ); } return $content; } /** * Get instructor info: total courses, total students. * * @param UserModel $instructor * * @return string * @version 1.0.1 * @since 4.2.3 */ public function instructor_item_info( UserModel $instructor ): string { $content = ''; try { $singleInstructorTemplate = SingleInstructorTemplate::instance(); $html_total_courses = sprintf( '
    %s
    ', $singleInstructorTemplate->html_count_courses( $instructor ) ); $html_total_students = sprintf( '
    %s
    ', $singleInstructorTemplate->html_count_students( $instructor ) ); $items = apply_filters( 'learn-press/list-instructors/instructor_item/info/sections', [ 'total_courses' => $html_total_courses, 'total_students' => $html_total_students, ], $instructor, $singleInstructorTemplate ); $sections = apply_filters( 'learn-press/list-instructors/instructor_item/wrapper', [ 'wrapper' => '
    ', 'content' => Template::combine_components( $items ), 'wrapper_end' => '
    ', ], $instructor ); $content = Template::combine_components( $sections ); } catch ( Throwable $e ) { error_log( __METHOD__ . ': ' . $e->getMessage() ); } return $content; } /** * Pagination of list instructor. * * @param int $page * @param int $limit * @param int $total_courses * * @return string */ public function instructors_pagination( int $page, int $limit, int $total_courses ): string { $content = ''; $instructors_page_id = learn_press_get_page_id( 'instructors' ); $instructors_page_url = trailingslashit( get_permalink( $instructors_page_id ) ); try { $total_pages = \LP_Database::get_total_pages( $limit, $total_courses ); $data_pagination = array( 'total' => $total_pages, 'current' => max( 1, $page ), 'base' => esc_url_raw( trailingslashit( $instructors_page_url . 'page/%#%' ) ), 'format' => '', 'per_page' => $limit, ); ob_start(); Template::instance()->get_frontend_template( 'shared/pagination.php', $data_pagination ); $content = ob_get_clean(); } catch ( Throwable $e ) { ob_end_clean(); error_log( __METHOD__ . ': ' . $e->getMessage() ); } return $content; } }