Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Pebblo / functions.md
Last active November 18, 2015 16:43 — forked from joshfeck/template-parts.md
Alters the order of single event details to display the description -> datetimes -> ticket selector. Coded by Josh.
@joshfeck
joshfeck / events_venue.php
Last active February 26, 2018 23:58
List of upcoming events for a venue. Requires Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_list_upcoming_events_for_a_venue( $post ) {
// query the events for this venue using EE_Venue's events() method
$query_params = array(
'order_by' => 'Datetime.DTT_EVT_start',
'order' => 'ASC',
array(
'status' => 'publish',
@joshfeck
joshfeck / template-parts.md
Last active November 18, 2015 16:19
This moves the ticket selector from before the event content to after the event content. Requires Event Espresso 4.8.24.p or greater.
@joshfeck
joshfeck / functions.php
Last active January 21, 2021 22:43
Event Espresso 4.2 and 4.3 capability filter examples. Thread: http://eventespresso.com/topic/ee4-creating-a-role-to-just-manage-espresso-events/
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// give user roles that can 'publish_posts' access to events, registrations, transactions, registration forms
// roles will also need 'manage_options' cap
add_filter ('FHEE_management_capability', 'my_custom_menu_management_capability');
function my_custom_menu_management_capability() {
return 'publish_posts';
@lorenzocaum
lorenzocaum / gist:848801a1173be464fbe7
Last active January 30, 2017 00:36
Enable WordPress debugging with debug log on and debug display on
<?php
//* Do NOT include the opening php tag
//* Enable WordPress debugging with debug log and debug display
define('WP_DEBUG', true);
if (WP_DEBUG) {
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);
}
@joshfeck
joshfeck / add-to-template.php
Created June 3, 2014 17:00
This gist works in conjunction with https://gist.github.com/joshfeck/52ac749150322a2e4221. You can add the following to /gateways/invoice/template.php to display the price without surcharge and surcharge amount as line items on the invoice.
// suggested code placement is right after the line that says:
// $pdf->ImprovedTable($header, $attendees, $w, $alling);
$pdf->Ln(1);
$pdf->my_itemised_surcharge($registration_ids, $attendees);
@joshfeck
joshfeck / add-to-function.pdf.php
Created June 3, 2014 16:58
This method can be added to the Espresso_PDF class in gateways/invoice/function.pdf.php to prepare some data to display the prices without the surcharge, and the surcharge amount as line items. Works with the Event Espresso 3.1.35.P or greater invoice template. Please see https://gist.github.com/joshfeck/e2b91cd6599000ecb772 for example template…
function my_itemised_surcharge($registration_ids, $attendees){
$options = get_option('events_organization_settings');
$currency = $options['currency_symbol'];
$this->SetFillColor(192,192,192);
// pull the selected ticket price breakdown from the database
global $wpdb, $org_options;
foreach( $registration_ids as $registration_id ) {
$price_query = "SELECT event_id, price_option FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id=%s";
@joshfeck
joshfeck / example-query.php
Last active May 10, 2018 19:27
An example of a query that can be placed into a page template that displays a list of events for Event Espresso 4
<ul class="events">
<?php
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$atts = array(
'paged' => $paged,
'title' => NULL,
'limit' => 100,
'css_class' => NULL,
'show_expired' => FALSE,
'month' => NULL,
@joshfeck
joshfeck / attendee_list.php
Last active August 29, 2015 14:01
Displays an attendee list after the content on the event details page. Displays the gravatar, first name, and last name of each attendee registered for an event. Requires Event Espresso 4.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// prints a per event attendee list right after the event details on a single event page
// you can change the action hook that's on the next line to display the list in another location
add_action( 'AHEE_event_details_after_the_content', 'ee_attendee_list' );
function ee_attendee_list(){
global $wpdb, $post;
@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active November 15, 2024 16:37
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s