This filter lets you override a Listing Builder template’s output HTML.


  • $output | string | The output HTML
  • $class | object | The FacetWP_Renderer class instance


How to use custom PHP code?

PHP code can be added to your (child) theme's functions.php file. Alternatively, you can use the Custom Hooks add-on, or a code snippets plugin. More info

add_filter( 'facetwp_template_html', function( $output, $class ) { $query = $class->query; ob_start(); while ( $query->have_posts() ): $query->the_post(); ?> <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> <?php endwhile; wp_reset_postdata(); return ob_get_clean(); }, 10, 2 );

More examples

See also