Overview

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

Parameters

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

Usage

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 ) { $GLOBALS['wp_query'] = $class->query; ob_start(); while ( have_posts() ): the_post(); ?> <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> <?php endwhile; return ob_get_clean(); }, 10, 2 );

More examples

See also