This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Get the search term | |
//replace `1526` with the ID of your search form | |
global $searchandfilter; | |
$sf_current_query = $searchandfilter->get(1526)->current_query(); | |
echo $sf_current_query->get_search_term(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//check if a form is active | |
global $searchandfilter; | |
if($searchandfilter->active_sfid()) | |
{ | |
//a valid search form exists | |
} | |
else | |
{ | |
//returns false if none is found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function filter_input_object($input_object, $sfid) | |
{ | |
//ensure we are only filtering the correct field name - in this case the field we want to filter has the name `_sfm_colours` | |
//we also want to make sure its a `select` input type we're filtering | |
if(($input_object['name']!='_sfm_colours')||($input_object['type']!='select')) | |
{ | |
return $input_object; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Get an array of objects containing data for the current search/filter | |
//replace `1526` with the ID of your search form | |
global $searchandfilter; | |
$sf_current_query = $searchandfilter->get(1526)->current_query(); | |
echo $sf_current_query->is_filtered(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<section id="primary" class="content-area"> | |
<main id="main" class="site-main" role="main"> | |
<?php if ( have_posts() ) : ?> | |
<?php | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ( $ ) { | |
"use strict"; | |
$(document).on("sf:ajaxfinish", ".searchandfilter", function(){ | |
var grid; | |
$(el).find($('.edd_download.content-grid-download')).attr('style', ''); | |
grid = document.querySelector(el); | |
salvattore['register_grid'](grid); | |
}); | |
}(jQuery)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this code does the re-layout work needed when using S&F with the blog module, and when S&F Ajax is enabled | |
(function ( $ ) { | |
"use strict"; | |
$(document).on("sf:ajaxfinish", ".searchandfilter", function(){ | |
console.log("ajax complete"); | |
var grids = document.getElementsByClassName('et_pb_blog_grid'); | |
salvattore['register_grid'](grids[0]); | |
}); | |
}(jQuery)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hck_filter_taxonomy_archives( $query_args, $sfid ) { | |
if( $sfid == 509 ) { | |
$query_args['post_type'] = 'articles'; | |
} | |
return $query_args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var el = wp.element.createElement; | |
const { __ } = wp.i18n; // Import __() from wp.i18n | |
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks | |
const { RichText, BlockControls, BlockFormatControls, AlignmentToolbar } = wp.editor; | |
const { Button, Dashicon, Tooltip, IconButton, Toolbar } = wp.components; | |
const { Component, Fragment } = wp.element; | |
//standard registerBlockType init | |
registerBlockType( 'my-block-plugin/block-w-insert-shortcode', { | |
title: 'Block w Shortcode Button', //any title you like |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Search & Filter Pro | |
* | |
* Sample Results Template | |
* | |
* @package Search_Filter | |
* @author Ross Morsali | |
* @link https://searchandfilter.com | |
* @copyright 2018 Search & Filter |