Skip to content

Instantly share code, notes, and snippets.

jQuery(document).ready(function($) {
//* FacetWP Isotope
var fwpScrollToBtn = false;
var $grid = $('.fwpl-layout');
$grid.imagesLoaded(function() {
//* Wrapped in a short timeout function because $grid.imagesLoaded doesn't reliably lay out correctly
setTimeout(function(){
$grid.isotope({
itemSelector: '.fwpl-result',
});
@mgibbs189
mgibbs189 / facet.js
Last active September 16, 2020 18:10 — forked from djrmom/custom-hooks.php
facetwp set order of (or remove) flyout facets
<?php
// Add to your (child) theme's functions.php, or into the Custom Hooks plugin!
add_action( 'wp_head', function() {
?>
<script>
(function($) {
FWP.hooks.addFilter('facetwp/flyout/facets', function(facets) {
@mgibbs189
mgibbs189 / custom-hooks.php
Last active February 16, 2019 14:34 — forked from djrmom/custom-hooks.php
facetwp shortcodes in layout builder
<?php
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
if ( 'el-2ydbgp' == $item['settings']['name'] ) {
$value = do_shortcode( $value );
}
return $value;
}, 10, 2 );
# How to install a new WordPress site from scratch using WP-CLI.
# We are going to assume that you have installed WP-CLI with all of the needed dependencies (composer, mysql, php) and added them to the global system/user path.
# Commands that you need to use in the CLI are marked with a ">" at the start of the row (you don't need to add that to the command).
# Create a new empty directory in your /www path. You can do that from the CLI directly. We are going to do a local install using WAMP software stack.
# Either go to the /www directory through explorer and create a new folder or use the following command in the CLI (you have to change your current directory to '/wamp/www' first).
> mkdir wordpress
@mgibbs189
mgibbs189 / custom-hooks.php
Last active September 20, 2018 12:39 — forked from djrmom/custom-hooks.php
facetwp scroll to top on wp_head hook
<?php
/** adds script to header with a conditional check to not scroll to top
** when the load more button has been clicked
**/
add_action( 'wp_head', function() { ?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
if (FWP.loaded && 'undefined' === typeof FWP_JSON.load_more) {
@mgibbs189
mgibbs189 / LICENSE.txt
Created May 19, 2018 02:33 — forked from larryfox/LICENSE.txt
Determine if an elements background color is light or dark!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2015 Larry Fox <http://larryfox.us>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mgibbs189
mgibbs189 / FacetWP set n selected
Created April 21, 2018 00:21 — forked from mattradford/FacetWP set n selected
Set the number of choices selected at which "{n} selected" will display. is_tax conditional left as an example.
/**
* Set {n} selected text to show after 1 selection, on all facets
*/
function td_facetwp_selected() {
if ( is_tax() ) {
?>
<script>
(function($) {
$(function() {
if ('undefined' !== typeof FWP) {
@mgibbs189
mgibbs189 / fSelect-numDisplayed
Created April 21, 2018 00:21 — forked from mattradford/fSelect-numDisplayed
Change FacetWP fSelect number of choices at which text changes to "{n} selected"
add_filter( 'facetwp_render_output', function( $output ) {
$output['settings']['location']['numDisplayed'] = 1;
return $output;
});
@mgibbs189
mgibbs189 / download-member-report.php
Created September 5, 2017 17:22 — forked from cparkinson/download-member-report.php
FacetWP template for generating csv of result set
<?php
/*
/*
Plugin Name: Download member report as csv
Plugin URI: http://
Description: This plugin is called when the 'download csv' button is clicked on the Member Reports page containing FacetWP search
Version: 1.0
Author: clare@greenbee-web.com
Author URI: http://www.greenbee-web.com/
License: GPL2
@mgibbs189
mgibbs189 / facet.js
Last active August 18, 2017 21:02 — forked from djrmom/facet.js
facetwp - click event to reset individual facet
(function($) {
$(document).on('click', '#reset', function() {
FWP.is_reset = true;
FWP.facets['my_facet'] = []; // set facet to no selections
delete FWP.facets['paged']; // remove "paged" from URL
FWP.refresh();
});
})(jQuery);