PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.7
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.7
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / inc / Models / ListCourseCategories.php

ListCourseCategories.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.7, at inc/Models/ListCourseCategories.php

47 lines 890 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class ListCourseCategories
5 *
6 * Handle lit course categories
7 *
8 * @package LearnPress/Classes
9 * @version 1.0.0
10 * @since 4.2.6.5
11 */
12
13 namespace LearnPress\Models;
14
15 use Throwable;
16
17 class ListCourseCategories {
18 /**
19 * Get all course categories
20 *
21 * @param array $arg_query_terms
22 *
23 * @return array [ term_id => term_name ]
24 */
25 public static function get_all_categories_id_name( array $arg_query_terms = [] ): array {
26 $terms = [];
27
28 try {
29 $arg_query_terms_default = [
30 'taxonomy' => LP_COURSE_CATEGORY_TAX,
31 'fields' => 'id=>name',
32 'parent' => 0,
33 'orderby' => 'term_order',
34 'order' => 'ASC',
35 ];
36
37 $arg_query_terms = array_merge( $arg_query_terms_default, $arg_query_terms );
38
39 $terms = get_terms( $arg_query_terms );
40 } catch ( Throwable $e ) {
41 error_log( __METHOD__ . ': ' . $e->getMessage() );
42 }
43
44 return $terms;
45 }
46 }
47