This add-on lets you display facets alongside Elementor Pro listings.

Supported widgets

Widget Plugin
Loop Grid Elementor Pro
Posts Elementor Pro
Ultimate Addons for Elementor
PowerPack for Elementor
Premium Addons for Elementor (Blog widget)
Archive Posts Elementor Pro
WooCommerce Products Elementor Pro
Ultimate Addons for Elementor
PowerPack for Elementor
Premium Addons for Elementor
WooCommerce Archive Products Elementor Pro
Listing Grid JetEngine
Post Blocks AnyWhere Elementor Pro (integration built into AEP)
Post Blocks Adv AnyWhere Elementor Pro (integration built into AEP). More info on the integration with FacetWP can be found on this AEP page.
Note: to disable the scroll on page load, see the instructions below.

Usage

After installation, there is no further configuration needed for this add-on. When it is installed, compatible Elementor listing modules will display an extra “FacetWP” setting. Toggling this setting to “Enabled” tells FacetWP to use the desired listing:

Facet filters and other display shortcodes can be added with Elementor’s shortcode widget.

FacetWP on WP archive templates

Elementer archive widgets

FacetWP can also be enabled on WP archive templates created with the Elementor Theme builder.

The Archive posts widget (for posts, pages, and custom post types) and the Archive products widget (for Woocommerce product archives) can be enabled in their settings for FacetWP in the same way as the above widgets, while automatically using the archive query for the results.

Using Elementor pagination

Elementor Posts or Archive Posts widget pagination settingsIf you are using Elementor’s pagination (which you can set in Posts, Archive Posts or Loop Grid widgets), FacetWP will detect this pagination and convert it for use with AJAX filtering.

However, this will only work for the pagination options that have numbered pagination. FacetWP will not work with the “Load on Click” or “Infinite Scroll” pagination types. (Side note: FacetWP will not work with any type of “Infinite load” pagination.)

You can also choose to not use Elementor’s pagination and instead add a Pager facet, which offers several pager types, among which a “Load more” type.

Block FacetWP from using the wrong post widget query

block_facet Query ID in Elementor

If FacetWP is identifying the wrong query in Elementor, you can use the query_id setting to block FacetWP from using a post widget query that it shouldn’t.

Give the ‘Query ID’ setting in the Elementer widget a value of “block_facet”, and add this code to your (child) theme’s functions.php:

add_action( 'elementor/query/block_facet', function( $query ) {
  $query->set( 'facetwp', false );
} );

Force FacetWP to use a specific post widget query

use_facet Query ID in Elementor

You can force FacetWP to use a specific Elementor query ID. Give the ‘Query ID’ setting in the Elementer widget a value of “use_facet”, and add this code to your (child) theme’s functions.php:

add_action( 'elementor/query/use_facet', function( $query ) {
  $query->set( 'facetwp', true );
} );

add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
  if ( true !== $query->get( 'facetwp', false ) ) {
    return false;
  }
  return $is_main_query;
}, 10, 2 );

Prevent page scroll with the AEP “Post Blocks Adv” widget

AnyWhere Elementor Pro Post Blocks Adv widget - preventing scroll on page loadIf you are using the AnyWhere Elementor Pro “Post Blocks Adv” widget (which has FacetWP integration), you may see the page scroll to the top of the results after interacting with facets.

This scroll on (AJAX) page load can be disabled by the “Disable Scroll to Top on Load” option, located under the “Pagination” section of the Post Blocks Adv widget.

Be aware that this Pagination section can be hidden if you happen to have the “Infinite Scroll” option enabled in the “Layout” section. If that is the case, disable the Infinite Scroll option, then go to the Pagination section and enable the “Disable Scroll to Top on Load” option.

It’s best to then keep the Infinite Scroll option disabled because FacetWP does not support any form of infinite scroll. The closest thing is the Pager facet, which has a pager type that generates a “load more” button, working similar to infinite scroll.

Customizing the Elementor Pro Posts widget query

If you are using Elementor Pro with a Posts widget, and you need more control over the query, you can use Elementor’s Custom Query Filter hook.

This hook works similar to WP’s pre_get_posts hook. It exposes the WP_Query object and allows you to customize the query in any way you want.

The following example adds a fallback sorting method by overriding the original orderby query argument, on category archive pages only:

function my_query_order( $query ) {
  if ( $query->is_category() && $query->is_main_query() ) {
    $query->set( 'orderby', [
      'date'  => 'DESC', // Primary sort: by post date
      'title' => 'ASC'   // Secondary, fallback sort: by post title
    ] );    
  }
}
add_action( 'elementor/query/{$query_id}', 'my_query_order' );

Changelog

1.7

1.6.7

  • New added support for "Premium Addons for Elementor" [Posts] and [WooCommerce] widgets

1.6.6

  • Fixed refined the JS refresh handler to (hopefully) account for edge cases

1.6.5

  • Fixed better compatibility with Elementor toggles and other dynamic elements

1.6.4

  • Fixed Elementor no longer runs a separate "theme builder template" query, so we're adjusting our logic accordingly

1.6.3

  • Improved removed jQuery dependency

1.6.2

  • Fixed prevent error when FacetWP is disabled

1.6.1

  • Fixed issue with WC Products widget not detecting the right query

1.6.0

  • Important this version requires FacetWP 3.6.0 or above
  • Improved compatibility with FacetWP 3.6.0+ and Elementor 3.0+

See also