Create your own filter control. It should inherit CMSAbstractQueryFilterControl. Then what you do is place a Filter webpart on your page, set the url of the control you created(i.e.: ~/CustomFolder/filter.ascx) then add a datasource to the page and assign the filter control to the datasource.
Essentially in your custom filter control, you create the WhereCondition, SelectColumns, OrderBy, etc. and call the RaiseOnFilterChanged() event and it will filter the datasource based on the values set in the filter control.
I have good example of the code in
this post