Exclude first post

Forums › Forums › Search & Filter Pro › Exclude first post

Tagged: 

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #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
    #263417

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

    Anonymous
    #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 );
    ?>

    Anonymous
    #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)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.