Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions includes/addons/CourseCarousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ protected function register_content_controls() {
]
);

$this->add_control(
'course_carousel_include_by_ids',
[
'label' => __( 'ID', 'tutor-lms-elementor-addons' ),
'type' => Controls_Manager::TEXT,
'default' => ''
]
);

$this->add_control(
'course_carousel_include_by_categories',
[
Expand Down Expand Up @@ -305,6 +314,15 @@ protected function register_content_controls() {
]
);

$this->add_control(
'course_carousel_exclude_by_ids',
[
'label' => __( 'ID', 'tutor-lms-elementor-addons' ),
'type' => Controls_Manager::TEXT,
'default' => ''
]
);

$this->add_control(
'course_carousel_exclude_by_categories',
[
Expand Down Expand Up @@ -340,6 +358,7 @@ protected function register_content_controls() {
'options' => [
'post_date' => __( 'Date', 'tutor-lms-elementor-addons' ),
'post_title' => __( 'Title', 'tutor-lms-elementor-addons' ),
'post__in' => __( 'ID', 'tutor-lms-elementor-addons' ),
],
'default' => 'post_date'
]
Expand Down
19 changes: 19 additions & 0 deletions includes/addons/CourseList.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,15 @@ protected function register_content_controls() {
)
);

$this->add_control(
'course_list_include_by_ids',
array(
'label' => __( 'ID', 'tutor-lms-elementor-addons' ),
'type' => Controls_Manager::TEXT,
'default' => '',
)
);

$this->add_control(
'course_list_include_by_categories',
array(
Expand Down Expand Up @@ -336,6 +345,15 @@ protected function register_content_controls() {
)
);

$this->add_control(
'course_list_exclude_by_ids',
array(
'label' => __( 'ID', 'tutor-lms-elementor-addons' ),
'type' => Controls_Manager::TEXT,
'default' => '',
)
);

$this->add_control(
'course_list_exclude_by_categories',
array(
Expand Down Expand Up @@ -371,6 +389,7 @@ protected function register_content_controls() {
'options' => array(
'post_date' => __( 'Date', 'tutor-lms-elementor-addons' ),
'post_title' => __( 'Title', 'tutor-lms-elementor-addons' ),
'post__in' => __( 'ID', 'tutor-lms-elementor-addons' ),
),
'default' => 'post_date',
)
Expand Down
10 changes: 10 additions & 0 deletions templates/course/course-carousel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="<?php tutor_container_classes(); ?> etlms-carousel-main-wrap">
<?php
$include_by_ids = $settings['course_carousel_include_by_ids'];
$exclude_by_ids = $settings['course_carousel_exclude_by_ids'];
$include_by_categories = $settings['course_carousel_include_by_categories'];
$exclude_by_categories = $settings['course_carousel_exclude_by_categories'];
$include_by_authors = $settings['course_carousel_include_by_authors'];
Expand Down Expand Up @@ -34,6 +36,14 @@ function is_bundle_enabled() {
),
);

if ( ! empty( $include_by_ids ) ) {
$args['post__in'] = (array) explode( ',', $include_by_ids );
}

if ( ! empty( $exclude_by_ids ) ) {
$args['post__not_in'] = (array) explode( ',', $exclude_by_ids );
}

if ( ! empty( $include_by_categories ) ) {
$tax_query = array(
'taxonomy' => 'course-category',
Expand Down
10 changes: 10 additions & 0 deletions templates/course/course-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
$course_list_perpage = $settings['course_list_perpage'];
$course_list_column = $settings['course_list_column'];

$include_by_ids = $settings['course_list_include_by_ids'];
$exclude_by_ids = $settings['course_list_exclude_by_ids'];
$include_by_categories = $settings['course_list_include_by_categories'];
$exclude_by_categories = $settings['course_list_exclude_by_categories'];
$include_by_authors = $settings['course_list_include_by_authors'];
Expand Down Expand Up @@ -43,6 +45,14 @@ function is_bundle_enabled() {
),
);

if ( ! empty( $include_by_ids ) ) {
$args['post__in'] = (array) explode( ',', $include_by_ids );
}

if ( ! empty( $exclude_by_ids ) ) {
$args['post__not_in'] = (array) explode( ',', $exclude_by_ids );
}

if ( ! empty( $include_by_categories ) ) {
$tax_query = array(
'taxonomy' => 'course-category',
Expand Down