Skip to content

Instantly share code, notes, and snippets.

View alanef's full-sized avatar

Alan Fuller alanef

View GitHub Profile
@alanef
alanef / widget-for-eventbrite-api.php
Created March 1, 2023 21:59
filter to add venue name to callist
add_filter('wfea_cal_list_event_extra_options', function($options) {
$post= get_post();
$venue= '';
if ( !empty($post->venue)) {
$venue = ' @ ' . $post->venue->name;
}
$options['title'] =$options['title'] . $venue;
return $options;
});
if ( $replace_with_your_freemius_global->can_use_premium_code__premium_only() ) {
// premium code users if they ever had a licence show the contact form
$replace_with_your_freemius_global->add_filter(
'is_submenu_visible',
function ( $is_visible, $menu_id ) {
/** @var \Freemius $replace_with_your_freemius_global Freemius global object. */
global $replace_with_your_freemius_global;
if ( 'contact' === $menu_id ) {
return $replace_with_your_freemius_global->has_any_license();
}
@alanef
alanef / index.php
Last active January 30, 2023 21:09
Custom Ranges for Display Eventbrite
<?php
/*
* Plugin Name: Custom Ranges for Display Eventbrite Events
* Plugin Description: This plugin allows you to set custom ranges for the Display Eventbrite Events plugin.
*/
/**
* Set the valid range for the list view.
*/
add_filter( 'wfea_cal_list_options' , function( $options ) {
@alanef
alanef / general.js
Created January 11, 2023 10:24
checkout freemius
/**
* Pricing Table Buttons and Freemius Functionlity.
*/
$('.pricing-table__button__trigger').click(function (e) {
debugger;
let coupon = null;
const article = document.querySelector("#home-pricing-id");
if ( article != null ) {
coupon = article.dataset.coupon;
}
@alanef
alanef / scratch_44.php
Created January 6, 2023 16:59
Custom filter for display eventbrite
<?php
/**
* Plugin Name: Display Eventbrite custom code filter
*/
add_filter( 'wfea_api_results', function ( $events, $query ) {
$events = array_filter( $events, function ( $event ) {
return ( isset( $event->post_title ) ) ? preg_match( '#More Than One Story#', $event->post_title ) : false;
} );
return $events;
@alanef
alanef / index.php
Created January 5, 2023 19:10
Code snippet to remove PROTECTED
<?php
/**
* Plugin Name: Remove Protected code snippet
* Description: Remove the protected from the content of a post
**/
add_filter( 'protected_title_format', function ( $format ) {
return '%s';
} );
<?php
// disable direct access
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// sending and saving form submission
if ( $error == false ) {
// hook to support plugin Contact Form DB
do_action( 'vscf_before_send_mail', $form_data );
@alanef
alanef / functions.php
Created November 24, 2022 19:08
qem_event_register filter
add_filter(
'qem_event_register',
/**
* @param $args https://developer.wordpress.org/reference/functions/register_post_type/#parameters
*
* @return array
*/
function ( $args ) {
$args['rewrite'] = array( 'slug' => 'my_custom_event_slug' );
add_action(
'rest_authentication_errors',
function() {
if ( ( preg_match( '/users/i', $_SERVER['REQUEST_URI'] ) !== 0 ) || ( isset( $_REQUEST['rest_route'] ) && ( preg_match( '/users/i', $_REQUEST['rest_route'] ) !== 0 ) ) ) {
if ( ! is_user_logged_in() ) {
$this->sue_log();
return new WP_Error( 'rest_cannot_access', esc_html__( 'Only authenticated users can access the User endpoint REST API.', 'stop-user-enumeration' ), array( 'status' => rest_authorization_required_code() ) );
}
}
@alanef
alanef / widget-for-eventbrite-api.php
Created September 20, 2022 07:51
Age Restriction Text Filter
add_filter(
'wfea_age_restriction',
/**
* @param $output string filterable output
* @param $age string Eventbrite string or all_ages
*
* @return string filtered output
*
*/
function ( $output, $age ) {