Skip to content

Instantly share code, notes, and snippets.

View alanef's full-sized avatar

Alan Fuller alanef

View GitHub Profile
add_filter(
'wfea_availability_display', // filter hook name
function ( $msg, $total_sold, $event_capacity ) { // annonyous function that takes 3 parameters - paramters are defined by the hook
if ( $total_sold >= $event_capacity ) {
$msg = __( 'Sold Out', 'widget-for-eventbrite-api' );
} else if ( ( $event_capacity - $total_sold ) > 10 ) { // set this number to what you like if you don't want a count
$msg = 'Places Available';
} else {
$msg = sprintf( '%1$s Places Left', ( $event_capacity - $total_sold ) );
}
jQuery(document).ready(function ($) {
// as nothing will be on the page we initialise with a call
ajax_call();
// on click of the search button we make the call with the filter value
$('#ajaxwfeasearch').click(function () {
ajax_call();
});
<?php
/*
Plugin Name: Test Ajax
Plugin URI: https://fullworks.net
Description: A demo of ajax calls to the Widget for Eventbrite plugin shortcode
Version: 1.0
Author: Alan Fuller
Author URI: https://fullworks.net
License: GPL3
<input type='text' id='ajaxwfeafilter'><button id='ajaxwfeasearch'>Search</button>
<hr>
<div id='ajaxwfea'></div>
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
@alanef
alanef / index.php
Last active January 31, 2024 10:42
<?php
/**
* Plugin Name: My Custom Code Snippets
* Description: Change the description and version as needed
* Version: 1.0
*/
// just a check to make sure no hacker tries this file
if ( ! defined('ABSPATH') ) {
die();
}
<?php
/**
* Plugin Name: Custom Exceprt Filter
* Description: Custom Excerpt Filter for Display Eventbrite
* Version: 1.0
*/
// just a check to make sure no hacker tries this file
if ( ! defined('ABSPATH') ) {
die();
}
add_filter( ‘eawp_excerpt’, function($content) {
return the_content();
}, 10,1);
function get_ip( $ipaddress = null ) {
if ( ! empty( $ipaddress ) ) {
if ( false === WP_Http::is_ip_address( $ipaddress ) ) {
return '0.0.0.0';
}
return $ipaddress;
}
$ipaddress = '0.0.0.0';
if ( getenv( 'HTTP_CF_CONNECTING_IP' ) ) {
<?php
/*
* Plugin Name: IPN Debug
*/
add_action( 'template_redirect', 'test_qem_ipn' );
function test_qem_ipn() {
global $qem_fs;
if ( ! isset ( $_GET['test_qem_ipn'] ) ) {
return;