Skip to content

Commit

Permalink
Merge pull request 10up#3658 from 10up/fix/issue-3603
Browse files Browse the repository at this point in the history
Manually enqueue facet meta range if in < WP 6.1
  • Loading branch information
felipeelia authored Sep 27, 2023
2 parents fa27532 + 0490899 commit 5733b5f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions includes/classes/Feature/Facets/Types/MetaRange/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ public function render_block( $attributes ) {
$renderer_class = apply_filters( 'ep_facet_renderer_class', __NAMESPACE__ . '\Renderer', 'meta-range', 'block', $attributes );
$renderer = new $renderer_class();

/**
* Prior to WP 6.1, if you set `viewScript` while using a `render_callback` function,
* the script was not enqueued.
*
* @see https://core.trac.wordpress.org/changeset/54367
*/
if ( version_compare( get_bloginfo( 'version' ), '6.1', '<' ) ) {
wp_enqueue_script( 'ep-facets-meta-range-block-view-script' );
}

ob_start();

$wrapper_attributes = get_block_wrapper_attributes( [ 'class' => 'wp-block-elasticpress-facet' ] );
Expand Down

0 comments on commit 5733b5f

Please sign in to comment.