Skip to content

Instantly share code, notes, and snippets.

@joshfeck
joshfeck / pastevents.php
Last active December 16, 2015 10:29
Displays a list of events that started before today's date. Can be placed into a page template or within a widget template. Requires WP + Event Espresso.
<ul>
<?php
global $wpdb;
$tablename = $wpdb->prefix . events_detail;
$pastevents = $wpdb->get_results("SELECT * FROM $tablename WHERE start_date < curdate() AND event_status <> 'D' ");
foreach ( $pastevents as $pastevent ){
echo '<li><a href="' . espresso_reg_url($pastevent->id) . '">' . stripslashes($pastevent->event_name) . '</a></li>';
}
?>
</ul>
@joshfeck
joshfeck / trickyjQ.php
Created May 3, 2013 13:36
An example of a somewhat complicated way of loading jQuery. Why not simply declare jQuery as a dependency and let WordPress manage the version of jQuery that is used?
<?php
// start with setting some defaults
/**
* Set defaults
*/
function squelch_taas_set_defaults() {
// Default versions of external scripts
$jquery_ver = '1.9.1';
$jquery_ui_ver = '1.10.2';
@joshfeck
joshfeck / calendar-theme.php
Created May 7, 2013 17:50
a function that loads up a themeroller stylesheet for the calendar. Can be placed in a theme's functions.php file
<?php
add_action('wp_enqueue_scripts', 'add_calendar_themeroller_stylesheet');
function add_calendar_themeroller_stylesheet() {
global $org_options;
global $espresso_calendar;
$page_array = explode(',', $espresso_calendar['calendar_pages']);
//print_r($page_array);
if ($espresso_calendar['calendar_pages'] != 0) {
if (!is_page($page_array)) {
return;
@joshfeck
joshfeck / payment_page.php
Created May 16, 2013 16:10
Modified payment_page.php template that takes into account someone returning back to edit attendee details from an email link. Event Espresso version 3.1.32.P
<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
do_action('action_hook_espresso_log', __FILE__, 'FILE LOADED', '');
//Confirmation Page Template
?>
<div class="espresso_payment_overview event-display-boxes ui-widget" >
<h3 class="section-heading ui-widget-header ui-corner-top">
<?php _e('Payment Overview', 'event_espresso'); ?>
</h3>
<div class="event-data-display ui-widget-content ui-corner-bottom" >
@joshfeck
joshfeck / espresso_table.php
Created June 17, 2013 16:47
Modified espresso_table.php so it can display a table of events based on the staff_id assigned to the events. Removes the category filtering. Requires WordPress, Event Espresso, and the custom files add-on.
<?php
/*
Shortcode Name: Espresso Table
Author: Seth Shoultes
Contact: seth@eventespresso.com
Website: http://www.eventespresso.com
Description: Only show events in a CATEGORY within a certain number number of days into the future and a qty. The example below only shows events in a certain category that start within 30 days from the current date.
Usage Example: [ESPRESSO_TABLE max_days="30" qty="3" staff_id="1" order_by="state"]
Custom CSS for the table display
Notes: This file should be stored in your "/wp-content/uploads/espresso/templates/" folder and you should have the custom_includes.php files installed in your "/wp-content/uploads/espresso/" directory.
@joshfeck
joshfeck / exclude_primary.php
Created June 19, 2013 16:31
Exclude the primary attendee count from the confirmation page and adjust the price to exclude the primary attendee. Requires Event Espresso 3.1.34.P or later.
//Calculate number of attendees, minus the primary attendee
function espresso_exclude_primary_attendee() {
$sql = " AND is_primary = '0' ";
return $sql;
}
add_filter('filter_hook_espresso_payment_page_count_attendees_sql_where', 'espresso_exclude_primary_attendee', 10);
//Make the primary attendee free
function espresso_primary_attendee_is_free($registration_id) {
global $wpdb;
@joshfeck
joshfeck / custom_events_profile_form.php
Created June 20, 2013 15:20
Custom user profile form for the WP user integration add-on. Requirs WP user integration + Event Espresso.
<?php
//remove the group of fields that get updated on the user profile page
remove_action('personal_options_update', 'event_espresso_extra_profile_fields');
remove_action('edit_user_profile_update', 'event_espresso_extra_profile_fields');
//add a custom group of fields to be updated
add_action('personal_options_update', 'my_custom_event_espresso_extra_profile_fields');
add_action('edit_user_profile_update', 'my_custom_event_espresso_extra_profile_fields');
function my_custom_event_espresso_extra_profile_fields($user_id) {
@joshfeck
joshfeck / espresso_table_display_table_function.php
Created July 9, 2013 17:01
custom espresso_display_table function that makes it possible to order by time instead of ordering by date only. Replaces the function of the same name in the espresso_table.php template
<?php
/*
Shortcode Name: Espresso Table
Author: Seth Shoultes
Contact: seth@eventespresso.com
Website: http://www.eventespresso.com
Description: Only show events in a CATEGORY within a certain number number of days into the future and a qty. The example below only shows events in a certain category that start within 30 days from the current date.
Usage Example: [ESPRESSO_TABLE max_days="30" qty="3" category_identifier="gracecard" order_by="state"]
Custom CSS for the table display
Notes: This file should be stored in your "/wp-content/uploads/espresso/templates/" folder and you should have the custom_includes.php files installed in your "/wp-content/uploads/espresso/" directory.
@joshfeck
joshfeck / registration_page_display.php
Last active December 19, 2015 20:08
This is a modified section of Event Espresso's registration_page_display.php template that adds a check to see if the user is logged in. If they are logged out, it will display a single price instead of a dropdown of price options. This is useful in situations where multiple price options are offered to Members (via the WP user integration add-o…
<?php
// Added for seating chart addon
$display_price_dropdown = TRUE;
if (defined('ESPRESSO_SEATING_CHART')) {
$seating_chart_id = seating_chart::check_event_has_seating_chart($event_id);
if ($seating_chart_id !== FALSE) {
$display_price_dropdown = FALSE;
}
@joshfeck
joshfeck / adm_update
Created July 18, 2013 17:36
update checked in quantity
UPDATE `wp_events_attendee`
SET `checked_in_quantity` = 1
WHERE `checked_in` = 1
AND `checked_in_quantity` = 0