Support Forums

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

Forums Forums Search & Filter Pro Exclude first post

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Patrick Leonberger
    #263365

    Hi there,

    I‘m building a layout in which a show the first post of a specific query on top of the page. Below I would like to show the filter and results for a query with the same values. Is it possible to exclude that first post as a variable? This ID is a changing ID.
    I tried with the offset, but then it breaks the ajax call of the filter.

    Thanks

    Trevor Moderator
    #263417

    I do not know of a way to do this, sorry.

    Pou Lala
    #276546

    Hi, I’ve a solution for that. You have to use the ‘offset’ parameter.

    I added this to function.php:
    <?php
    function sf_filter_query_args( $query_args, $sfid ) {

    //if search form ID = 225, the do something with this query
    if($sfid==31940)
    {
    //modify $query_args here before returning it
    //only show results within categories with these IDs
    $query_args['offset'] = '1';
    }
    return $query_args;
    }
    add_filter( 'sf_edit_query_args', 'sf_filter_query_args', 10, 2 );
    ?>

    Pou Lala
    #276548

    Sorry for the bad writing:

    function sf_filter_query_args( $query_args, $sfid ) {
      
      //if search form ID = 225, the do something with this query
      if($sfid==31940)
      {
      	//modify $query_args here before returning it
            //only show results within categories with these IDs
      	$query_args['offset'] = '1';
      }
      return $query_args;
    }
    add_filter( 'sf_edit_query_args', 'sf_filter_query_args', 10, 2 );
    
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.