→ facetwp_template_html

Overview

This filter lets you override a FacetWP template’s output.

Parameters

  • $output | mixed | The output HTML (or false to use the default HTML)
  • $class | object | The FacetWP_Facet class and all properties (see /includes/class-facet.php)

Usage

<?php
function my_facetwp_template_html( $output, $class ) {
    global $wp_query;
    $wp_query = $class->query;

    ob_start();
?>
    <?php while ( have_posts() ): the_post(); ?>
    <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
    <?php endwhile; ?>
<?php
    return ob_get_clean();
}

add_filter( 'facetwp_template_html', 'my_facetwp_template_html', 10, 2 );