Gists

by mgibbs189 - 11 months ago

<?php

add_filter( 'facetwp_shortcode_html', function( $output, $atts ) {
    if ( isset( $atts['template'] ) ) {
        $output = str_replace( 'facetwp-template', 'facetwp-template row', $output );
    }
    return $output;
}, 10, 2 );
by djrmom - 11 months ago

<?php
/** changes <div class="facetwp-template" in facetwp template shortcode output to a ul
 ** will not work if facetwp_use_pager_seo is true
 **/

add_filter( 'facetwp_shortcode_html', function( $output, $atts ) {
    if ( !empty( $atts['template'] ) && 'example' == $atts['template'] ) { // change "example" to your template name
        $output = str_replace( '<div class="facetwp-template"', '<ul class="facetwp-template"', $output );
        $output = substr_replace( $output, '</ul>', -6 );
    }
    return $output;
}, 10, 2 );
by djrmom - 1 year ago

<?php
/** add additional classes / id to the facetwp-template div generated by a facetwp 
 ** layout template
 **/
add_filter( 'facetwp_shortcode_html', function( $output, $atts) {
	if ( $atts['template'] = 'example' ) { // replace 'example' with name of your template
    /** modify replacement as needed, make sure you keep the facetwp-template class **/
		$output = str_replace( 'class="facetwp-template"', 'id="masonry-container" class="facetwp-template small-up-1 medium-up-2 large-up-3"', $output );
	}
	return $output; 
}, 10, 2 );