Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* After creating the necessary table, run with `wp eval-file plugin-stats.php`
*/
use WP_CLI\Utils;
global $wpdb;
$original_request_url = 'https://wordpress.org/plugins/wp-json/plugins/v1/query-plugins?s=&posts_per_page=100';
@Apina
Apina / gist:655e3fa46e049a0a8dfd
Created May 13, 2015 15:08
650+ English Stop Words (stopwords) in A-Z order, prepped for an array (PHP)
'\'tis',
'\'twas',
'a',
'a\'s',
'able',
'about',
'above',
'according',
'accordingly',
'across',
@Apina
Apina / custom_functions.php
Created February 19, 2015 08:51
Removes price modifiers (rather than taxes) from the price, so it shows the base price.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
// display the base price of the ticket in the ticket selector without Price Modifiers.
add_filter( 'FHEE__ticket_selector_chart_template__ticket_price', 'change_ee_ticket_selector_base_price_display', 10, 2 );
function change_ee_ticket_selector_base_price_display( $ticket_price, $ticket ) {
$x = $ticket->base_price();
@Apina
Apina / modify_reg_id.php
Last active August 29, 2015 14:14
EE4 modify registration ID
<?php
// Please do NOT include the opening php tag, except of course if you're starting with a blank file
function change_reg_code($new_reg_code, $registration) {
//create a new reg ID e.g. business-1598
$new_reg_code = "business-" . rand(1000, 10000);
//send the new reg code back to be used.
@Apina
Apina / associatedevents.php
Created December 15, 2014 07:58
Associated Events plugin for EE4 - adds meta box to EE4 venues to make it easier to see which events have this venue attached.
<?php
/*
Plugin Name: Associated Events for EE4
Plugin URI:
Description: Adds an Associated Events meta baox to EE4 venues, which lists which events the venue has been attached to.
Version: 0.0.1
Author: Dean Robinson
Author URI:
*/
@Apina
Apina / gist:fbbcf04cfce29f503086
Created December 9, 2014 07:38
EE4 detect if it's an EE4 event or event archive
<?php if ( get_post_type( $post ) == "espresso_events" || is_post_type_archive( "espresso_events" ) ) {
//do something
} else {
//do something else
}
?>
@Apina
Apina / customfunction.php
Created November 20, 2014 11:58
EE4 (4.4.5) get the event ids in the SPCO
add_action('AHEE__registration_page_attendee_information__start', 'dxxx', 10, 1 );
function dxxx($event_queue) {
//var_dump($event_queue);
$my_registrations = $event_queue['items']; foreach($my_registrations as $a_reg) { echo $a_reg[event] -> ID(); }
}
@Apina
Apina / custom_functions.php
Created November 11, 2014 08:35
EE3 - Modified function to make additional attendees free
//Please note that this is a non supported code snippet. Event Espresso will not provide general support for it, nor may it be updated.
//Please only use as an example for your own code
function espresso_make_additional_relay_teammates_free ($ext_att_data_source) {
global $wpdb;
//As this function is called for each attendee, lets bail if it's the primary attendee.
if( $ext_att_data_source['is_primary'] == true ) {
return;
@Apina
Apina / example.php
Created September 29, 2014 10:34
EE4 US Phone and Zip validation: This needs to be added to a custom functions plugin or similar. It is very basic, for instance it loads on every page rather than just EE related pages, but should provide a basis for allowing validation. Also note that the addClass required isn't strictly necessary but may be useful.
function dr_validate() {
wp_register_script( 'drvalid', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js', array('jquery'), '1.13.0', true );
wp_register_script( 'drvalid2', 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/additional-methods.min.js', array('jquery'), '1.13.0', true );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'drvalid' );
wp_enqueue_script( 'drvalid2' );
}
add_action('wp_enqueue_scripts','dr_validate');
@Apina
Apina / ee_add_jquery.php
Created July 30, 2014 09:42
This should no longer be required after 4.6.4 as there is an option in the Gateway settings -- Adds a little jQuery to automatically open the Payment options.
<?php
/*
Plugin Name: EE adds JavaScript to show the payment options automatically.
Description: EE adds JavaScript to show the payment options automatically.
*/
/* Begin Adding Functions Below This Line */
function ee_1() {