Skip to content

Instantly share code, notes, and snippets.

View brandonkramer's full-sized avatar
🏠
Working from home

Brandon Kramer brandonkramer

🏠
Working from home
View GitHub Profile
@birgire
birgire / woo-product-attributes-bulk-modifier.php
Last active June 6, 2024 13:30
WordPress: WooCommerce Product Attributes - Bulk Modifier ( from custom meta attributes to taxonomy attributes)
<?php
/**
* Plugin Name: WooPAM: Woo Product Attributes Modifier
* Description: Bulk update 'custom meta product attributes' to 'taxonomy product attributes' in WooCommerce. Supports the GET variables, like: woopam_mode=run&woopam_from_attribute_meta=colour&woopam_to_attribute_tax=pa_colour&woopam_keep_attribute_meta&woopam_posts_per_page=10&woopam_paged=0&woopam_post_type=product&woopam_post_status=any. WARNING: Backup DB first!!!
* Plugin Author: birgire
* Author URI: https://github.com/birgire
* Plugin URI: https://gist.github.com/birgire/0ed300ae4436fcaf508c
* Version: 1.0.0
* License: GPL2+
* Text Domain: woopam
<?php
function lazyloadImages($html) {
$matches = array();
preg_match_all( '/<img[\s\r\n]+.*?>/is', $html, $matches );
$search = array();
$replace = array();
foreach ( $matches[0] as $imgHTML ) {
@eksiscloud
eksiscloud / functions.php
Created June 6, 2020 15:28
Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin)
# Check: https://onexa.nl/wordpress/toolbar-link-redis-object-cache/
/**
* Add a link to the Admin Toolbar to easily flush the Redis cache (Redis Object Cache plugin)
*
* @author Hiranthi Herlaar, onexa.nl
*
* @var $wp_admin_bar > https://codex.wordpress.org/Class_Reference/WP_Admin_Bar
**/
function redis_add_toolbar_link( $wp_admin_bar )
{
@prionkor
prionkor / createHashSource.js
Created August 9, 2020 11:08
Hash Source for reach/router
"use strict";
const getHashPath = () => {
const href = window.location.href;
const hashIndex = href.indexOf('#');
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
};
const pushHashPath = path => window.location.hash = path;
const replaceHashPath = path => {