This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
### Example of adding an extra column to the Event Tickets/Event Tickets Plus | |
### attendee table. | |
### | |
### Tested with Event Tickets Plus 4.6.2 | |
# Register our extra column | |
add_filter( 'tribe_tickets_attendee_table_columns', function( $columns ) { | |
$columns['extra'] = 'My extra column'; | |
return $columns; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance()->ticket_add( $event_id, [ | |
'ticket_name' => 'Test ticket ' . uniqid(), | |
'ticket_provider' => 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main', | |
'ticket_price' => '100', | |
'tribe_ticket' => [ | |
'mode' => 'global', | |
'event_capacity' => '100', | |
'capacity' => '' | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Every 2 mins (`-n 120` where 120 is num seconds), display a new joke. | |
# | |
# - On MacOS you may need to `brew install watch` first of all. | |
# - Fun to place this in a small Tmux pane | |
watch -n 120 "curl -s -H \"Accept: text/plain\" https://icanhazdadjoke.com/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generates a set of scheduled actions for testing purposes. | |
* | |
* Additionally, it provides test callbacks (which do very little except burn time). | |
* How much fun is that? | |
* | |
* An easy way to add this command is to place the file in the wp-content/mu-plugins | |
* directory, or else incldue it from a file in that directory. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Makes Query Monitor output available to all users. | |
* | |
* This can, for example, be added to mu-plugins/query-monitor.php (and can | |
* easily be disabled by changing 'init' to 'xinit', or commenting the whole | |
* thing out, or adding a return statement, etc). | |
* | |
* Reasons you might use this instead of simply setting Query Monitor's own |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Delete WooCommerce session data for a specific user. | |
DELETE session_data, | |
session_meta | |
FROM wp_woocommerce_sessions AS session_data | |
JOIN wp_usermeta AS session_meta ON | |
session_meta.user_id = session_data.session_key | |
-- Set the `session_key` value to the target `user_id`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get a string containing a random fact. | |
* | |
* If a random fact cannot be fetched from the external service, a default is | |
* supplied instead. | |
* | |
* @return string | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'register_tea_flavours', 100 ); | |
add_action( 'parse_query', 'focus_on_events_for_tea_flavour_queries' ); | |
function register_tea_flavours() { | |
register_taxonomy( 'tea_flavours', TribeEvents::POSTTYPE, array( | |
'label' => 'Tea Flavours' | |
) ); | |
register_taxonomy_for_object_type( 'tea_flavours', TribeEvents::POSTTYPE ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove events tagged with any of the slugs listed below from | |
* event views. | |
* | |
* We deliberately avoid use of TEC functions and constants etc | |
* so that this doesn't break should that plugin temporarily be | |
* deactivated. | |
*/ | |
add_filter( 'pre_get_posts', function( $query ) { |