Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@hellofromtonya
hellofromtonya / term-hierarchical-search.php
Last active February 27, 2024 13:18
WordPress Term Hierarchical Search
<?php
/**
* Term Hierarchical Search
*
* These methods provide a utility interface to find a meta value
* within the term's hierarchy. It walks up the hierarchy starting
* at the given term, i.e. walks to its parent -> grandparent -> N levels.
*
* It's performant as it grabs the records it needs out of the database
* with one SQL query, i.e. to avoid multiple trips to gather each level's
@hellofromtonya
hellofromtonya / term-metadata.php
Last active July 21, 2017 14:51
Grab all of the term ancestors (child and walk up the tree) + the requested metadata.
<?php
/**
* Get the specified metadata value for the term or from
* one of it's parent terms.
*
* @since 1.0.0
*
* @param WP_Term $term Term object
* @param string $meta_key The meta key to retrieve.
@stereokai
stereokai / index.css
Created June 18, 2017 11:03
Trigonometry in CSS
//----------------------------------*\
// TRIGONOMETRY FUNCTIONS
//----------------------------------*/
// # Trigonometry in CSS
//
// - Through Taylor/Maclaurin polynomial representation: http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf
// - Useful if you don't want to use JS.
// - With CSS Variables.
// - `calc()` can't do power (x ^ y) so I used multiplication instead.
@chillybin
chillybin / countdown.php
Created October 27, 2016 13:06
Simple PHP Date Countdown
<div class="home-section promo">
<div class="wrap">
<div class="row gutter-40 middle-xs">
<div class="col col-xs-12 col-sm-4 widget rwc-countdown">
<div class="row bottom-xs-10 center-xs">
<div class="col cd-head col-xs-12">
<h4>20 SEPTEMBER - 2 NOVEMBER 2019</h4>
</div>
</div>
<div class="row cd-date gutter-5 bottom-xs-10 center-xs">
@adamwathan
adamwathan / troubleshooting.md
Last active January 19, 2021 04:14
Troubleshooting Valet on macOS Sierra

Troubleshooting Valet on Sierra

Common Problems

Problem: I just see "It works!"

Apache is running on port 80 and interfering with Valet.

  1. Stop Apache: sudo /usr/sbin/apachectl stop
  2. Restart Valet: valet restart
@JustinSainton
JustinSainton / use-email-for-login-woocommerce.php
Created January 27, 2016 03:35
Use the submitted email address for the username in WooCommerce registration.
<?php
add_filter( 'woocommerce_new_customer_data', function( $data ) {
$data['user_login'] = $data['user_email'];
return $data;
} );
@trepmal
trepmal / toggle-debug.php
Last active September 4, 2020 15:42
WordPress experiment. Toggle debug from admin bar
<?php
/*
Plugin Name: Toggle Debug
Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love.
*/
/*
// In wp-config.php, wrap debug constants in a cookie conditional
if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) {
define('WP_DEBUG', true);
}
@robneu
robneu / video-embed.html
Last active March 23, 2018 15:50
Embed a YouTube video using featherlight.js
<a href="https://www.youtube.com/embed/CEYRBTZWu8U" data-featherlight="iframe" data-featherlight-iframe-width="960" data-featherlight-iframe-height="540">
<img class="alignnone" src="http://img.youtube.com/vi/CEYRBTZWu8U/maxresdefault.jpg" alt="" width="1280" height="720" />
</a>
@mathetos
mathetos / plugin.php
Last active April 13, 2023 16:48
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
@johnbillion
johnbillion / wp_mail.md
Last active January 27, 2024 14:06
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail