• Resolved limitcracker

    (@limitcracker)


    Hi all,

    I am using FacetWP along with LifterLMS and I want to be able to filter based on Course Difficulties, Categories etc. Although I think I am making everything correctly the Filtering elements not showing.
    I observed that the generated PHP code by FacetWP for filtering among course difficulties is the following:

    <?php
    return array(
      "post_type" => array(
        "course",
        "lesson"
      ),
      "post_status" => "publish",
      "orderby" => "title",
      "order" => "ASC",
      "posts_per_page" => 10,
      "tax_query" => array(
        array(
          "taxonomy" => "course_difficulty",
          "field" => "slug",
          "terms" => "course-difficulty"
        )
      )
    );

    and the code for displaying is the following:

    <?php while ( have_posts() ) : the_post(); ?>
        <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
    <?php endwhile; ?>
      Do you think those snippets are correct?
      Are the Query Arguments like “course”, “lesson” going to successfully do the search in LifterLMS?
      Any ideas?

    https://www.ads-software.com/plugins/lifterlms/

Viewing 6 replies - 1 through 6 (of 6 total)
  • @limitcracker,

    I am not familiar with FacetWP but base don the supplied snippets it appears to be passing data to a WP_Query, if that’s the case then yes, these snippets appear correct as “course” and “lesson” are the post types LifterLMS uses for courses and lessons (respectively) and “course_difficulty” is our difficulty taxonomy. You’ll need to verify whether or not the “terms” is correct based on difficulties you currently have on your site.

    The final difficulty here is that LifterLMS Courses and Lessons are not searchable by default , this would not affect a WP_Query, unless there’s extra arguments added by FacetWP that obey the searchability of a registered post type. You opened another thread very recently about this which has a solution — please take a look at the solution proposed there https://www.ads-software.com/support/topic/searchwp-issue-with-lifterlms?replies=6

    Take care,

    Thanks @thomasplevy

    FacetWP author here, the issue is very likely due to the post types not being searchable. Good diagnosis.

    More info: https://facetwp.com/documentation/faq/#facet-empty

    @limitcracker After making those post types searchable (see the last link in Thomas’ reply), hit the Re-index button.

    Cheers

    Since Facet has confirmed my assumptions, let’s give you a better snippet to make both courses and lessons searchable:

    function llms_post_type_searchable( $args ) {
        $args['exclude_from_search'] = false;
    
        return $args;
    }
    
    add_filter( 'lifterlms_register_post_type_course', 'llms_post_type_searchable' );
    add_filter( 'lifterlms_lesson_post_type_course', 'llms_post_type_searchable' );

    This will make both courses and lessons searchable.

    Let me also note, however, that our INTENTION here is that lessons and courses both contain content which should only be available to ENROLLED students. By making this content searchable that content can now be discoverable by non-enrolled students.

    That might be totally fine for you but we added this during our initial beta because our beta testers overwhelmingly concurred that this content should NOT be searchable. We’re probably going to add some better search functionality and options in the future but that’s where we stand today.

    Take care,

    Thread Starter limitcracker

    (@limitcracker)

    Hi! Thnx for the replies!

    @thomasplevy do you think there is a way to only make specific parts of a course searchable. i.e. only the Title or the Course Category that is into?

    Br,

    @limitcracker,

    As far as I know this is not possible via WP_Query or standard WordPress searching methods. It’s conceivably possible as *everything* is conceivably possible but I’m not sure how to go about helping you with that as we’re starting to deal with customization for your website alone.

    If you do some research and find some things I’m happy to direct you on the implications given the LifterLMS codebase but I can’t come up with anything *easy* enough to answer with a code snippet.

    Sorry,

    Thread Starter limitcracker

    (@limitcracker)

    Thank you for your quick responses! Being searchable it’s ok by me for now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘FacetWP Issue with LifterLMS’ is closed to new replies.