Skip to content

Instantly share code, notes, and snippets.

View chikaibeneme's full-sized avatar
:atom:
Focusing

Chika Ibeneme chikaibeneme

:atom:
Focusing
  • iKaDigital
  • Jamaica
View GitHub Profile
@chikaibeneme
chikaibeneme / change-organizer-slug-to.php
Created January 21, 2025 23:16
Change Organizer Slug to 'Ponent' in The Events Calendar (WordPress)
<?php
function modify_organizer_type_properties( $properties ) {
// Change the slug to "ponent"
$properties['rewrite']['slug'] = 'ponent';
return $properties;
}
// Hook into the organizer type registration for Events Calendar Pro
add_filter( 'tribe_events_register_organizer_type_args', 'modify_organizer_type_properties' );
@chikaibeneme
chikaibeneme / delete-events-by-title.php
Created January 21, 2025 22:15
Delete Events by Title in The Events Calendar (WordPress)
<?php
add_action('init', function() {
global $wpdb;
// Title of the events to delete
$event_title = 'Scrabble 1';
// Query to find events with the specified title
$events = $wpdb->get_results(
$wpdb->prepare(
@chikaibeneme
chikaibeneme / publish all events.php
Last active February 22, 2025 04:07
publish all events
function forcefully_publish_all_events() {
global $wpdb;
// Get all event IDs directly from the database
$event_ids = $wpdb->get_col("
SELECT ID
FROM {$wpdb->posts}
WHERE post_type = 'tribe_events'
AND post_status NOT IN ('publish')
");
@chikaibeneme
chikaibeneme / tec-tickets-email-rsvp-alternate-bcc.php
Created November 29, 2024 04:45
Add a custom BCC for the RSVP email (All ticket emails)
<?php
//* Do NOT include the opening php tag
/**
* If you want the BCC added to all ticket-related emails, regardless of type.
* Useful for broader email handling, especially if your organization manages multiple ticket types.
*/
add_filter( 'tribe_tickets_email_headers', function( $headers, $ticket_id ) {
@chikaibeneme
chikaibeneme / Add Virtual Meeting URL and Organizer Link to Event Description in iCal Feed.php
Created November 13, 2024 21:21
Add Virtual Meeting URL and Organizer Link to Event Description in iCal Feed.php
@chikaibeneme
chikaibeneme / registration_label_change.php
Last active November 1, 2024 06:11
Change the attendee registration default field name.
<?php //Do not copy this line
add_filter( 'tribe_tickets_plus_attendee_registration_iac_fields', 'modify_attendee_fields' );
function modify_attendee_fields( $fields ) {
// Check if 'Name' field exists before modifying
if ( isset( $fields['name'] ) ) {
$fields['name']['label'] = 'First Name'; // Change label to 'First Name'
}
// Optionally, you can add other modifications here
@chikaibeneme
chikaibeneme / registration_fields.php
Last active November 1, 2024 06:09
Change the name of the registration fields
add_filter( 'tribe_tickets_plus_attendee_registration_iac_fields', 'modify_attendee_fields' );
function modify_attendee_fields( $fields ) {
// Check if 'Name' field exists before modifying
if ( isset( $fields['name'] ) ) {
$fields['name']['label'] = 'First Name'; // Change label to 'First Name'
}
// Optionally, you can add other modifications here
// For example, changing placeholder text:
@chikaibeneme
chikaibeneme / Example for adding event data to WooCommerce checkout for Events Calendar tickets.php
Created January 18, 2024 05:41
Example for adding event data to WooCommerce checkout for Events Calendar tickets.php
/**
* Example for adding event data to WooCommerce checkout for Events Calendar tickets.
*
*/
add_filter('woocommerce_cart_item_name', 'woocommerce_cart_item_name_event_title', 10, 3);
function woocommerce_cart_item_name_event_title($title, $values, $cart_item_key) {
// Check if the product is an Events Calendar ticket
$product_id = isset($values['product_id']) ? $values['product_id'] : null;
@chikaibeneme
chikaibeneme / Add category to all events.php
Created January 11, 2024 05:28
To add a category to all events using The Events Calendar in WordPress
// Add category to all events
function add_category_to_all_events() {
// Get all events
$events = get_posts(array(
'post_type' => 'tribe_events',
'posts_per_page' => -1, // Get all events
));
// Check if events are found
if ($events) {