Skip to content

Instantly share code, notes, and snippets.

View lorenzocaum's full-sized avatar

Lorenzo Orlando Caum lorenzocaum

View GitHub Profile
@amdrew
amdrew / gist:1e548cb7934b2678c1b2
Last active February 27, 2016 18:01
Easy Digital Downloads - Milestone Sale Alerts
<?php
/**
* Milestone Sale Alerts
* Be notified when a specific download is sold X times.
*/
function sumobi_edd_milestone_sales_alert( $purchase_id ) {
// ID of download to check
$download_id = 8;
@joshfeck
joshfeck / custom-ee-widget.php
Last active August 18, 2021 23:00
A clone of the stock EE4 Upcoming Events widget, in its own plugin
<?php
/*
Plugin Name: Alternative Event Espresso upcoming events widget
Description: A custom event list widget for Event Espresso 4
Version: 1.2
*/
// Register and load the widget
//
add_action( 'widgets_init', 'my_load_customEE_widget' );
@Apina
Apina / example.php
Created September 29, 2014 10:34
EE4 US Phone and Zip validation: This needs to be added to a custom functions plugin or similar. It is very basic, for instance it loads on every page rather than just EE related pages, but should provide a basis for allowing validation. Also note that the addClass required isn't strictly necessary but may be useful.
function dr_validate() {
wp_register_script( 'drvalid', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js', array('jquery'), '1.13.0', true );
wp_register_script( 'drvalid2', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/additional-methods.min.js', array('jquery'), '1.13.0', true );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'drvalid' );
wp_enqueue_script( 'drvalid2' );
}
add_action('wp_enqueue_scripts','dr_validate');
@joshfeck
joshfeck / wpe_heartbeat.php
Last active March 7, 2017 22:28
DE-disallows WPEngine's disallowing of the WordPress Heartbeat API
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter( 'wpe_heartbeat_allowed_pages', 'my_wpe_add_allowed_pages' );
function my_wpe_add_allowed_pages( $heartbeat_allowed_pages ) {
$heartbeat_allowed_pages = array(
'index.php',
'admin.php',
'edit.php',
@joshfeck
joshfeck / archive-espresso_events.php
Last active January 15, 2016 14:02
Custom archive template for the Espresso Events post type. This can be used in a Genesis child theme. Requires Event Espresso 4.
<?php
remove_action ( 'genesis_loop', 'genesis_do_loop' ); // Remove the standard loop
add_action( 'genesis_loop', 'custom_espresso_events_archive_loop' ); // Add custom loop
// Optional: Remove post info
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
function custom_espresso_events_archive_loop() {
@mannieschumpert
mannieschumpert / gist:e5cec8723247f9490016
Created October 9, 2014 21:01
Remove Gravity Forms' "Add Form" button from all WYSIWYG editors
<?php
add_filter( 'gform_display_add_form_button', function(){return false;} );
@joshfeck
joshfeck / content-espresso_events.php
Last active August 29, 2015 14:07
Event Espresso 4 event content template part that will display only events that have tickets available on the event list page
<?php
/**
* This template will display a single event - copy it to your theme folder
*
* @ package Event Espresso
* @ author Seth Shoultes
* @ copyright (c) 2008-2013 Event Espresso All Rights Reserved.
* @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing *
* @ link http://www.eventespresso.com
* @ version 4+
@joshfeck
joshfeck / page-events-past.php
Last active February 17, 2016 20:17
A Genesis-ready page template for Event Espresso 4 that displays an archive of past events in an html table.
<?php
/**
* Template Name: Custom Event Archive Only Template
*/
remove_action ( 'genesis_loop', 'genesis_do_loop' ); // Remove the standard loop
add_action( 'genesis_loop', 'custom_event_archive_only_loop' );
function custom_posts_where_sql_for_only_expired() {
@joshfeck
joshfeck / order-filter-event-category.php
Created October 29, 2014 03:22
Event Espresso 4's event category archives. Ordered by event datetime start and expired events removed.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// re-order the event category archives
add_filter('posts_orderby', 'edit_event_category_archive_orderby' );
function edit_event_category_archive_orderby( $orderby ) {
global $wpdb;
if( is_tax( 'espresso_event_categories' )) {
$orderby = "{$wpdb->prefix}esp_datetime.DTT_EVT_start ASC";
return $orderby;
@joshfeck
joshfeck / single-espresso_events.php
Created November 12, 2014 20:25
Custom single event template for the Espresso Events post type. This can be used in a Genesis child theme. Requires Event Espresso 4.
<?php
remove_action ( 'genesis_loop', 'genesis_do_loop' ); // Remove the standard loop
add_action( 'genesis_loop', 'custom_espresso_events_single_loop' ); // Add custom loop
// Optional: Remove post info
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
function custom_espresso_events_single_loop() {