Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ken Nguyen

    (@kendy73)

    Hi kendy_nd,

    Sorry for my late reply. I discussed with my team mates, we will include that feature in next update of LearnPress. It’s easy to use. Please wait :).

    Thanks for your idea.

    Regards,

    Ken

    Plugin Contributor Ken Nguyen

    (@kendy73)

    Add a snippet into your theme functions:

    function your_theme_filter_courses( $where ) {
    	global $wp_query;
    	if ( $wp_query->is_main_query() && is_search() && ! empty( $_REQUEST['ref'] ) && ( $_REQUEST['ref'] == 'course' ) ) {
    		$where = preg_replace( '!IN \(.*\)!', ' = \'lpr_course\'', $where );
    	}
    
    	return $where;
    }
    
    add_filter( 'posts_where', 'your_theme_filter_courses' );
    function your_theme_search_to_archive( $template ) {
    
    	if ( is_search() && ! empty( $_REQUEST['ref'] ) && ( $_REQUEST['ref'] == 'course' ) ) {
    		$template = learn_press_locate_template( 'archive-course.php' );
    	}
    
    	return $template;
    }
    
    add_filter( 'template_include', 'your_theme_search_to_archive' );

    Then create a form search with query ref, like this: example.com?s=something&ref=course

    Hope this help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggest search the courses solution’ is closed to new replies.