Skip to content

Instantly share code, notes, and snippets.

danieliser / edd_perpetual_discounts.php
Created February 18, 2022 09:55 — forked from polevaultweb/edd_perpetual_discounts.php
EDD - Allow discounts to be set to apply to all renewals
add_filter( 'edd_update_discount', 'edd_perpetual_discounts_add_meta' );
add_filter( 'edd_insert_discount', 'edd_perpetual_discounts_add_meta' );
add_action( 'edd_edit_discount_form_before_use_once', 'edd_perpetual_discounts_setting', 10, 2 );
add_filter( 'edd_get_option_recurring_one_time_discounts', 'edd_perpetual_discounts_discounts' );
function edd_perpetual_discounts_add_meta( $meta ) {
$meta['use_renewals'] = 0;
danieliser / eddsl-auto-activate.php
Created October 21, 2020 20:22 — forked from zackkatz/eddsl-auto-activate.php
Auto-activate sites on Easy Digital Downloads Software Licensing
add_filter( 'edd_sl_is_site_active', 'your_namespace_is_site_active_auto_activate_site', 10, 3 );
* Allow active licenses to get updates if they're not at the limit, no matter what.
* @param false $is_active
* @param int $license_id
* @param string $passed_site_url
danieliser / Set Cookie on Form Submit and Close
Last active February 1, 2023 03:44 — forked from rgadon107/Set Cookie on Form Submit and Close
Custom function to pass in a jQuery script to set a cookie via manual JS during 'on_click' trigger event and on form close.
add_action( 'wp_footer', 'my_custom_popup_scripts', 500 );
function my_custom_popup_scripts() { ?>
<script type="text/javascript">
(function ($, document, undefined) {
.on('pumAfterOpen', function () {
danieliser / Popup Maker - at 3 pages popup
Created June 4, 2016 19:19 — forked from rwkyyy/Popup Maker - at 3 pages popup
Simle jQuery to show a popup at 3rd page of a visitor - Wordpress Popup Maker
jQuery(document).ready(function ($) {
var visited = Cookies.get('visited');
if (visited == undefined) {
Cookies.set('visited', 0, {path: '/'});
else if (visited < 2) {
Cookies.set('visited', ++visited, {path: '/'});
else if (visited == 2) {
danieliser / csv_to_array.php
Created December 20, 2015 00:03 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
* Example:
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
* Use * for origin
add_action( 'rest_api_init', function() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' );

Towards a data model for scalable queries against rich WordPress post attribute data

This document is in draft status, and is being made available for peer review. If you have feedback, feel free to comment directly on this gist or email me directly.

Say you have an object with a complex, idiosyncratic attribute structure. Let's say you're a web developer, and a client of yours is a gemstone dealer in Manhattan. They have an inventory of gemestones that needs to be tracked.

Gemstones have a rich plethora of attributes. Gemstone type (e.g. sapphire or emerald), price, weight, width, height, depth, color, shape, country of origin, treatment (if it's heat treated),

danieliser /
Created June 26, 2014 00:08 — forked from jookyboi/
CSS libraries and guides to bring some order to the chaos.


  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.