Skip to content

Instantly share code, notes, and snippets.

Jenny Ragan djrmom

Block or report user

Report or block djrmom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@djrmom
djrmom / custom-hooks.php
Created Apr 1, 2020
facetwp schedule index after pmxi_after_xml_import
View custom-hooks.php
<?php
/** schedule one time index **/
add_action( 'pmxi_after_xml_import', function() {
wp_schedule_single_event( time(), 'fwp_single_index', array() );
});
/** needs to be availble to cron to run **/
function fwp_single_index() {
FWP()->indexer->index();
}
@djrmom
djrmom / base-products-renderer.php
Created Mar 13, 2020
facetwp proposed update to elementor-pro/modules/woocommerce/classes/base-products-renderer.php
View base-products-renderer.php
<?php
namespace ElementorPro\Modules\Woocommerce\Classes;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
abstract class Base_Products_Renderer extends \WC_Shortcode_Products {
public $query_results;
@djrmom
djrmom / custom-hooks.php
Created Mar 11, 2020
facetwp custom data in json
View custom-hooks.php
<?php
/** return custom data in the json facet returns on refresh
** access with FWP.settings.my_data in JS
*/
add_filter( 'facetwp_render_output', function( $output, $params ) {
$output['settings']['my_data'] = 'some data';
return $output;
}, 10, 2 );
@djrmom
djrmom / custom-hooks.php
Last active Mar 24, 2020
facetwp loading animation to cover all facets
View custom-hooks.php
<?php
/** sample of css and js to create a custom loading animation to cover the full facet area
** change #facet-container to a id or class of container element for your facets
** update css as needed
** please see https://facetwp.com/documentation/support/ for questions
**/
add_action( 'wp_head', function() { ?>
<style>
#facet-container {
@djrmom
djrmom / custom-hooks.php
Created Mar 9, 2020
facetwp sort ACF taxonomy relationship fields by term order of the tax
View custom-hooks.php
<?php
/**
* order facets by term order
* note: facets are an ACF relationship field
* rather than a direct taxonomy field which
* prevents use of taxomomy order directly with get_terms_orderby
*/
add_filter( 'facetwp_facet_orderby', function( $orderby, $facet ) {
// use 'facet_name' => 'taxonomy slug'
$ordered_facets = [
@djrmom
djrmom / custom-hooks.php
Created Mar 3, 2020
facetwp searchwp pdf excerpt
View custom-hooks.php
<?php
/** adds pdf excerpt to results from a facetwp search facet with searchwp engine
** based on https://searchwp.com/docs/kb/add-pdf-snippet-to-excerpts/
** change 'keywords' to name of your facet in ln 25-26
**/
add_filter( 'get_the_excerpt', function( $excerpt ) {
global $post;
@djrmom
djrmom / facet.js
Created Feb 25, 2020
facetwp slider css
View facet.js
/* move reset button to right of slider */
.facetwp-slider-reset {
position: absolute;
top: -8px;
right: -60px;
}
.facetwp-type-slider {
position: relative;
}
@djrmom
djrmom / facet.css
Created Feb 24, 2020
facetwp proxmity css
View facet.css
/** override min width for proximity facet input **/
input.facetwp-location {
min-width: auto !important;
}
@djrmom
djrmom / custom-hooks.php
Created Feb 19, 2020
facetwp wp import index all
View custom-hooks.php
<?php
/** do full re-index after wp all import **/
function fwp_import_posts() {
if ( function_exists( 'FWP' ) ) {
FWP()->indexer->index();
}
}
add_action( 'pmxi_after_xml_import', 'fwp_import_posts' );
@djrmom
djrmom / custom-hooks.php
Created Feb 6, 2020
facetwp woocommerce archive only facets
View custom-hooks.php
<?php
/** for sites that only use facets on woocommerce archive pages -
** shop page, product category archives, product tag archives,
** any others auto-created by woocommerce
** not for [product] shortcode or custom queries
**/
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
if ( 'product_query' != $query->get( 'wc_query' ) ) {
$is_main_query = false;
You can’t perform that action at this time.