9 months ago
/**
** adds is-hidden class to facetwp template to initial hide template.
** for use with conditional logic addon to show/hide template with
** conditions, prevents flash of content when hidden is the initial
** state
**/
add_filter( 'facetwp_shortcode_html', function( $output, $atts ) {
if ( isset( $atts['template'] ) && 'my_template' == $atts['template'] ) { // change my_template to match your template
$output = str_replace( 'class="facetwp-template"', 'class="facetwp-template is-hidden"', $output );
}
return $output;
}, 10, 2 );
3 years 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 );
3 years 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 );
4 years 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 );