5,
's' => $keyword,
'post_type' => 'academy_courses',
);
$query = new \WP_Query( apply_filters( 'academy/course_search_query_args', $args ) );
$item_markup = '';
if ( $query->have_posts() ) {
while ( $query->have_posts() ) :
$query->the_post();
$item_markup .= '
' .
// phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
'
' . get_the_title() . '
';
endwhile;
wp_reset_postdata();
} else {
$item_markup = '' . esc_html__( 'No course found', 'academy' ) . '';
}
wp_send_json_success( '' );
}
public function search_form( $atts ) {
$attributes = shortcode_atts(array(
'placeholder' => esc_html__( 'Search Course', 'academy' ),
), $atts);
ob_start();
\Academy\Helper::get_template(
'shortcode/search.php',
shortcode_atts(array(
'placeholder' => $attributes['placeholder'],
), $atts)
);
$output = ob_get_clean();
return apply_filters( 'academy/templates/shortcode/academy_course_search', $output );
}
}