Skip to content

Instantly share code, notes, and snippets.

@jchristopher
jchristopher / functions.php
Last active January 26, 2022 23:24
Automatically link to WooCommerce Product Variation detail when searching for a Product Variation SKU
<?php
// When using SearchWP it's necessary to disable WooCommerce's insistance on
// automatically redirecting to a single search result without showing the
// search results page, when that happens this hook doesn't run!
// Willing to bet this can be edited to accommodate, tips are welcome!
add_filter( 'woocommerce_redirect_single_search_result', '__return_false' );
function my_maybe_woocommerce_variation_permalink( $permalink ) {
if ( ! is_search() ) {
@hissy
hissy / really-simple-csv-importer-addon.php
Created February 25, 2015 14:01
[Really Simple CSV Importer] Example: import image from url to custom field
<?php
/*
Plugin Name: Get Remote Image to Custom Field
*/
add_filter('really_simple_csv_importer_post_saved', function($post)
{
if (is_object($post)) {
// Get the meta data of which key is "image"
$image = $post->image;
@jchristopher
jchristopher / gist:945ce9088423c9679b49
Last active August 29, 2015 14:08
Set up a custom wrapper div for facetwp-template in Genesis
<?php
// open the FacetWP Template wrapper
function be_open_facetwp_template_wrapper() {
echo '<div class="facetwp-template">';
}
add_action( 'genesis_before_loop', 'be_open_facetwp_template_wrapper', 9999 );
// close the FacetWP Template wrapper
@larryfox
larryfox / LICENSE.txt
Last active February 3, 2026 22:10
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