Skip to content

Instantly share code, notes, and snippets.

Josh Feck joshfeck

Block or report user

Report or block joshfeck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshfeck
joshfeck / version.php
Created Aug 28, 2015
You can use this to verify PHP version info for your server.
View version.php
<?php
if ( version_compare( PHP_VERSION, '5.0.0', '>=' ) ) {
echo 'I am using PHP 5, my PHP_VERSION: ' . PHP_VERSION;
}
echo '<br>My phpversion(): ' . phpversion();
if ( defined ( 'PHP_VERSION_ID' ) ) {
echo '<br>My PHP_VERSION_ID: ' . PHP_VERSION_ID;
@joshfeck
joshfeck / custom_functions.php
Created Feb 4, 2014
Adds an "Add to cart" link onto the single event registration page. Requires Event Espresso and its Multi Event Registration add-on.
View custom_functions.php
<?php
add_action('action_hook_espresso_social_display_buttons', 'single_custom_cart_link');
function single_custom_cart_link($event_id) {
global $wpdb;
$event_name = $wpdb->get_var("SELECT event_name FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
?><div class="custom-cart-link" style="display:block;">
@joshfeck
joshfeck / custom_functions.php
Last active Aug 29, 2015
use WP the_content() filter to translate a payment type.
View custom_functions.php
<?php
function my_change_check( $content ) {
$content = str_replace( '<td>Check</td>', '<td>Cheque</td>', $content);
return $content;
}
View custom_functions.php
<?php
function espresso_ticket_information($atts) {
global $wpdb;
extract($atts);
$price_option = "{$price_option}";
$type = "{$type}";
switch ($type) {
case 'ticket':
@joshfeck
joshfeck / main.php
Last active Aug 29, 2015
update the price option correctly
View main.php
<?php
if (!function_exists('espresso_ticket_information')) {
function espresso_ticket_information($atts) {
global $wpdb;
extract($atts);
$price_option = "{$price_option}";
$type = "{$type}";
@joshfeck
joshfeck / po_payment_vars.php
Created Feb 20, 2014
This gist updates the po_payment_vars.php file found in the Event Espresso 3 PO gateway and adds some simple jQuery validation.
View po_payment_vars.php
<?php
function espresso_display_purchase_order($payment_data) {
global $org_options;
extract($payment_data);
$default_gateway_version = empty($default_gateway_version) ? '' : $default_gateway_version;
echo '<!-- Event Espresso Purchase Order Gateway Version ' . $default_gateway_version . '-->';
$po_payment_settings = get_option('event_espresso_purchase_order_payment_settings');
View functions.php
<?php
//* Do NOT include the opening php tag
//* Load Lato and Merriweather Google fonts
add_action( 'wp_enqueue_scripts', 'bg_load_google_fonts' );
function bg_load_google_fonts() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,700|Merriweather:300,700', array(), CHILD_THEME_VERSION );
}
@joshfeck
joshfeck / custom_functions.php
Created Apr 1, 2014
Compatibility fix for servers running PHP5.2. Fixes an issue with exporting an Event Espresso attendee list if using ticketing on a server running PHP 5.2. Upload this file to /wp-content/uploads/espresso/
View custom_functions.php
<?php
class EEDateTime extends DateTime
{
public static function createFromFormat($format, $time, $timezone = null)
{
if(!$timezone) $timezone = new DateTimeZone(date_default_timezone_get());
$version = explode('.', phpversion());
if(((int)$version[0] >= 5 && (int)$version[1] >= 2 && (int)$version[2] > 17)){
return parent::createFromFormat($format, $time, $timezone);
@joshfeck
joshfeck / page-minimal.php
Created Apr 10, 2014
This is a simple, minimally-styled, single page template to be used for an Event Espresso payments page template when using an offsite gateway like Authorize.net SIM where adding SSL isn't a viable option. It will not match your WordPress theme, with the exception of Ice Cap, which this template was based on: http://wordpress.org/themes/ice-cap
View page-minimal.php
<?php
/*
Template Name: minimal
*/
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
@joshfeck
joshfeck / ee_add_taxonomy_post_class.php
Last active Aug 29, 2015
Adds a class name to the Event Espresso event post's post class so events that belong to a specific category can be uniquely styled with CSS. Requires Event Espresso 4.2.
View ee_add_taxonomy_post_class.php
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// Add a class name to the event post's post class that's based on the category it's assigned to
add_filter( 'post_class', 'ee_add_taxonomy_post_class', 10, 3 );
function ee_add_taxonomy_post_class( $classes, $class, $ID ) {
$taxonomy = 'espresso_event_categories';
$terms = get_the_terms( (int) $ID, $taxonomy );
You can’t perform that action at this time.