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 / Replace header tags.php
Created March 14, 2025 15:16
Replace event title heading from <h3> to <h1> on pages with the "page-template-default" class.
function my_swap_event_heading_js() {
?>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Check if the body contains the "page-template-default" class.
if ( document.body.classList.contains('page-template-default') ) {
// Select all event title elements by the specific class.
var titles = document.querySelectorAll('.tribe-events-pro-photo__event-title');
titles.forEach(function(title) {
// If the element is an H3, replace it with an H1.
@chikaibeneme
chikaibeneme / visitor_timezone.php
Created March 5, 2025 00:13
Showing Events in the Visitor Time Zone list view classic editor
<?php
/**
* View: List View - Single Event Date
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe/events/v2/list/event/date.php
*
* See more documentation about our views templating system.
*
* @link http://evnt.is/1aiy
@chikaibeneme
chikaibeneme / require tickets.php
Created February 28, 2025 07:03
require tickets.php
// Add the custom 'has_tickets' field to the list of required fields
add_filter( 'tribe_events_community_required_fields', function( $fields ) {
// Add our custom field identifier to the required fields array
$fields[] = 'has_tickets';
return $fields;
} );
// Validate the 'has_tickets' field during event submission
add_filter( 'tribe_community_events_validate_submission', function( $valid, $event_id, $args ) {
// Check if the current user is an admin; if so, skip validation
@chikaibeneme
chikaibeneme / date.php
Created February 28, 2025 06:23
date.php override.
<?php
/**
* View: List View - Single Event Date
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe/events/v2/list/event/date.php
*
* See more documentation about our views templating system.
*
* @link http://evnt.is/1aiy
@chikaibeneme
chikaibeneme / PayPal Client request.php
Created February 27, 2025 04:18
* Patch the PayPal Client request() method to capture arguments once * and avoid re-capturing them on retry.
<?php
/**
* Patch the PayPal Client request() method to capture arguments once
* and avoid re-capturing them on retry.
*
* Requires the runkit or runkit7 extension.
*/
add_action( 'plugins_loaded', function() {
if ( ! function_exists( 'runkit_method_redefine' ) ) {
error_log( 'Runkit extension is not available; PayPal Client patch was not applied.' );
@chikaibeneme
chikaibeneme / Event Featured image to product thumbnail.php
Created February 17, 2025 20:36
Event Featured image to product thumbnail.php
@chikaibeneme
chikaibeneme / replace_organizer_slug_in_urls.php
Last active April 3, 2025 13:35
replace_organizer_slug_in_urls
<?php
// Force organizer post type slug to "ponent"
function modify_organizer_type_properties($properties)
{
$properties["rewrite"] = [
"slug" => "ponent",
"with_front" => false, // Optional: depends on your permalink settings
];
return $properties;
@chikaibeneme
chikaibeneme / attendee-info-sortable-column.php
Created February 6, 2025 14:14
attendee-info-sortable-column.php
/**
* Adjust the query to sort by "Attendee Information" on the tickets attendees page.
*
* Assumes attendee information is stored as post meta under 'attendee_info'.
*
* @param WP_Query $query The current WP_Query instance.
*/
function optimized_sort_attendee_column( $query ) {
if (
is_admin() &&
@chikaibeneme
chikaibeneme / replace_organizer_slug_in_urls.php
Created January 31, 2025 21:50
replace_organizer_slug_in_urls
// Force organizer post type slug to "ponent"
function modify_organizer_type_properties( $properties ) {
$properties['rewrite'] = array(
'slug' => 'ponent',
'with_front' => false, // Optional: depends on your permalink settings
);
return $properties;
}
add_filter( 'tribe_events_register_organizer_type_args', 'modify_organizer_type_properties' );
@chikaibeneme
chikaibeneme / optimize-events-calendar-recurrence.php
Created January 25, 2025 06:25
Optimize Recurrence Period for Better Performance
function custom_recurrence_max_months( $value ) {
return 12; // Change to 6 or 12 for better performance
}
add_filter( 'tribe_get_option_recurrenceMaxMonthsAfter', 'custom_recurrence_max_months' );