=== Universal AJAX Filter ===
Contributors: prostilmangasule, walstartechnologies, pratapvashi123, walstarmedia
Tags: ajax filter, elementor, search filter, product filter, custom post type
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Build AJAX-powered filters for posts, products, and custom post types visually — with a shortcode and a native Elementor widget, no code required.

== Description ==

Smart Ajax Filter lets you build front-end filter bars that refresh results instantly via AJAX — without writing a single AJAX handler. Create as many filter sets as you need from a simple admin screen, then drop each one into a page using a shortcode or the plugin's own Elementor widget.

Each filter set can combine multiple fields — Search, Dropdown/Select, Checkbox, and Radio — bound to any taxonomy and its terms, and can drive one of four result actions:

* **Query Posts** – filter standard WordPress posts
* **Query Products** – filter WooCommerce-style product post types
* **Filter CPT** – filter any custom post type on your site
* **Load Elementor Template** – render matching items through an Elementor Pro Loop Item template

= Key Features =

* **Visual filter builder** — add, reorder, and remove filter fields from the admin screen; no code editing needed.
* **Multiple filter types** — Search, Dropdown/Select, Checkbox, and Radio, each bindable to any taxonomy and specific terms.
* **Four result actions** — Query Posts, Query Products, Filter CPT, or Load an Elementor Template, so one tool covers blogs, shops, and custom content types.
* **Shortcode support** — every saved filter gets its own shortcode, e.g. `[psaf_smart_ajax_filter id="12"]`, ready to paste into any page, post, or widget area.
* **Native Elementor widget** — search for "Smart Ajax Filter" in the Elementor panel and configure a filter directly inside the page editor, with no shortcode or saved filter needed.
* **Elementor normal grid support** — when using the standard Elementor editor, filtered results can be displayed using a regular Elementor grid without requiring Elementor Pro.
* **Elementor Pro Loop Grid support** — filter results can be rendered using Elementor Pro Loop Grid and Loop Item templates, allowing you to use your custom Loop Item designs. **Elementor Pro is required for Loop Grid/Loop Item functionality.**
* **Custom results target** — results load by default into a `.psaf-results` container, or you can point the filter at your own CSS selector to filter an existing grid on the page.
* **Configurable pagination and sorting** — set results per page, order-by field, and sort direction per filter.
* **Custom loading and empty-state text** — set your own "Loading..." and "No results found." messages per filter.
* **Multiple filters per site** — build unlimited independent filter sets, each with its own configuration, shortcode, and widget instance.
* **Lightweight front end** — vanilla AJAX requests with dedicated frontend CSS/JS assets, only loaded where needed.

= How It Works =

1. Go to **Smart Ajax Filter → Add New** in the WordPress admin menu.
2. Choose a post type, result action (Query Posts, Query Products, Filter CPT, or Load Elementor Template), results-per-page, and sort order.
3. Add one or more filter fields (Search, Dropdown/Select, Checkbox, Radio) and bind each to a taxonomy and, optionally, specific terms.
4. Save the filter — you'll get a ready-to-use shortcode, e.g. `[psaf_smart_ajax_filter id="12"]`.
5. Paste the shortcode into any page or post, **or** open Elementor and drag in the "Smart Ajax Filter" widget to configure the same filter directly in the builder.
6. Visitors filter results instantly on the front end — no page reload.

= Requirements =

* WordPress 5.8 or higher.
* PHP 7.4 or higher.
* Elementor (free) is only required if you want to use the native Elementor widget — the shortcode works with any theme or page builder.
* Elementor Pro is only required if you choose the "Load Elementor Template" result action to render results through a Loop Item template.

== Installation ==

1. Upload the `prostil-smart-ajax-filter` folder to the `/wp-content/plugins/` directory, or install the plugin zip through **Plugins → Add New → Upload Plugin**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Smart Ajax Filter → Add New** to create your first filter.
4. Copy the generated shortcode into a page/post, or add the "Smart Ajax Filter" widget from the Elementor panel.

== Frequently Asked Questions ==

= Do I need Elementor to use this plugin? =

No. The shortcode `[psaf_smart_ajax_filter id="X"]` works on any theme or page builder. The Elementor widget is an optional, additional way to add and configure a filter directly inside the Elementor editor.

= Can I filter WooCommerce products? =

Yes. Choose the "Query Products" result action and set the post type accordingly when creating a filter.

= Can I filter a custom post type? =

Yes. Choose "Filter CPT" as the result action and select your custom post type from the Post Type dropdown.

= Can filters target an existing results grid on my page instead of generating their own? =

Yes. By default results load into a `.psaf-results` container, but you can set a custom CSS selector as the results target in the filter settings to hook into your own existing grid.

= Does this work with Elementor Loop Item templates? =

Yes, if Elementor Pro is active. Set the result action to "Load Elementor Template" and select the Loop Item template you want filtered results rendered through.

= Can I create more than one filter? =

Yes. Create as many independent filter sets as you need from **Smart Ajax Filter → Add New** — each has its own configuration, shortcode, and can also be added as a separate Elementor widget instance.

== Screenshots ==

1. Elementor widget – Layout settings (filters position, sidebar width, columns, gap).
2. Elementor widget – Query & Results settings with Loop Item template selection.
3. Elementor widget – Filter controls (Search, Dropdown, Checkbox) with AND/OR logic.
4. Smart Ajax Filter widget in the Elementor editor with live preview.
5. Shortcode usage and the frontend filter output with results grid.
6. Admin – Query, Frontend, and Elementor Loop Item Template settings.
7. Admin – Add AJAX Filter screen with Basic Settings and Multiple Filters.

== Changelog ==

= 1.0.0 =
* Initial release: visual filter builder, Search/Dropdown/Select/Checkbox/Radio filter types, AJAX results, shortcode support for Posts, Products, and custom post types.


