Skip to content

Instantly share code, notes, and snippets.

View alanef's full-sized avatar

Alan Fuller alanef

View GitHub Profile
/**
* Filter to modify the returned data from Display Eventbrite
* to take the day of the start date and apply it to teh end of teh last day of
* multi day events
*
* So the event appears as a single bookable entry in calendar layouts
*
*/
add_filter(
'wfea_api_results', // hook to filter returned event data before display
<?php
add_shortcode( 'my_filter', function ( $atts ) {
ob_start();
?>
<form method="get">
<select name="category_name">
<option value="name1">Name1</option>
<option value="name2">Name2</option>
</select>
<input type="submit" value="Filter">
$url = "https://v3.openstates.org/jurisdictions';
$args = array(
'headers' => array (
'X-API-KEY' => 'your api key here'
),
);
$response = wp_remote_get( $url, $args );
$response_code = wp_remote_retrieve_response_code( $response );
if ( 200 != $response_code ) {
<?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;
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' ) ) {
add_filter( ‘eawp_excerpt’, function($content) {
return the_content();
}, 10,1);
<?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();
}
@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();
}
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
<input type='text' id='ajaxwfeafilter'><button id='ajaxwfeasearch'>Search</button>
<hr>
<div id='ajaxwfea'></div>