Torsten Liebig

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: add_filter() to listings page? #60525

    Torsten Liebig
    Free User
    Post count: 1

    That did the trick. I added the filters to pre_get_posts like so:

    
    
    add_action( 'pre_get_posts', 'add_custom_sql_filters' );
    function add_custom_sql_filters( $query ) {
        if( ! is_admin() && $query->query["post_type"] == "gd_place" ) :
            add_filter( 'posts_join', 'geodir_filter_widget_listings_join', 10, 2 );
            add_filter( 'posts_where', 'geodir_filter_widget_listings_where', 10, 2 );
        endif;
        return $query;
    }

    which works like a charm. Thanks!

Viewing 1 post (of 1 total)