Skip to content

Commit

Permalink
= 4.2.6.5 =
Browse files Browse the repository at this point in the history
~ Added: hook learn-press/filter-courses/sections/field
  • Loading branch information
tungnxt89 committed Apr 6, 2024
1 parent f6c3e4c commit 38ae236
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions inc/TemplateHooks/Course/FilterCourseTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ public function sections( array $data = [] ) {
foreach ( $data['fields'] as $field ) {
if ( is_callable( [ $this, 'html_' . $field ] ) ) {
$sections[ $field ] = [ 'text_html' => $this->{'html_' . $field}( $data ) ];
} elseif ( isset( $field['class'] ) && isset( $field['method'] ) ) { // For custom field.
if ( is_callable( [ $field['class']::instance(), $field['method'] ] ) ) {
$sections[ $field ] = [ 'text_html' => $field['class']::instance()->{$field['method']}( $data ) ];
}
} else { // For custom field.
apply_filters( 'learn-press/filter-courses/sections/field', $sections, $field, $data );
}
}

Expand Down Expand Up @@ -152,9 +150,9 @@ public function html_search( array $data = [] ): string {
);

$this->check_param_url_has_lang( $data );
$value = LP_Request::get_param( 'c_search' );
$value = isset( $data['params_url'] ) ? ( $data['params_url']['c_search'] ?? $value ) : $value;
$content = sprintf(
$value = LP_Request::get_param( 'c_search' );
$value = isset( $data['params_url'] ) ? ( $data['params_url']['c_search'] ?? $value ) : $value;
$content = sprintf(
'<input type="text" name="c_search" placeholder="%s" value="%s" class="%s" data-search-suggest="%d">',
__( 'Search Course', 'learnpress' ),
$value,
Expand Down Expand Up @@ -628,11 +626,11 @@ public function handle_filter_params_before_query( LP_Course_Filter &$filter, ar

// Check has in category page.
if ( isset( $params_url['page_term_id_current'] ) &&
empty( $params_url['term_id'] ) ) {
empty( $params_url['term_id'] ) ) {
$filter->term_ids[] = $params_url['page_term_id_current'];
} // Check has in tag page.
elseif ( isset( $params_url['page_tag_id_current'] ) &&
empty( $params_url['tag_id'] ) ) {
empty( $params_url['tag_id'] ) ) {
$filter->tag_ids[] = $params_url['page_tag_id_current'];
}
}
Expand Down

0 comments on commit 38ae236

Please sign in to comment.