Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Not working on page load

Tagged: 

Viewing 10 posts - 1 through 10 (of 11 total)
  • James Piper
    #196334

    Hello Team,

    No matter where I search, I can’t find a way to make the plugin run on page load.

    Once I start clicking around, the ajax filtering works fine, but I need it to work on the first page load too.

    We are using the code below to remove one of the options and to set the default active item. This all works fine.

    // Remove “All Courses” option and set main to default on Our Menu.
    add_filter( ‘sf_input_object_pre’, function ( $input_object, $sfid ) {
    if ( $sfid == 120 ) {
    // var_dump($input_object);
    if ( ( $input_object[‘name’] = ‘_sft_course’ ) ) {
    if ( empty( $input_object[‘defaults’][0] ) ) {
    $input_object[‘defaults’] = [ ‘main’ ];
    }
    $key = array_search( ‘All Courses’, array_column( $input_object[‘options’], ‘label’ ) );
    if ( $key !== false ) {
    unset( $input_object[‘options’][ $key ] );
    $input_object[‘options’] = array_values( $input_object[‘options’] );
    }
    }
    }

    return $input_object;
    }, 10, 2 );

    Can you please tell me how to instruct the plugin to run in the fresh page load?
    I can’t find the answer anywhere in the docs or internet.

    Thank you very much,
    Kota

    Trevor Moderator
    #196339
    This reply has been marked as private.
    James Piper
    #196353
    This reply has been marked as private.
    Trevor Moderator
    #196395
    This reply has been marked as private.
    James Piper
    #196511
    This reply has been marked as private.
    James Piper
    #196572
    This reply has been marked as private.
    Trevor Moderator
    #196611
    This reply has been marked as private.
    Trevor Moderator
    #196613
    This reply has been marked as private.
    James Piper
    #196621
    This reply has been marked as private.
    James Piper
    #196627
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 11 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.