Skip to content

Instantly share code, notes, and snippets.

@lelandf
Created November 16, 2022 22:18
Show Gist options
  • Save lelandf/8f213b4b84402bd7da01c6dc7a4aeed3 to your computer and use it in GitHub Desktop.
Save lelandf/8f213b4b84402bd7da01c6dc7a4aeed3 to your computer and use it in GitHub Desktop.
[TEC] Remove price block from Event bock template
<?php
add_filter( 'tribe_events_editor_default_template', function( $template ) {
// collect an array of template values, like "tribe/event-price" and tribe/event-venue"
$template_search = array_column( $template, 0 );
// Get the index of the "tribe/event-price"
$price = array_search( "tribe/event-price", $template_search );
// @link: https://www.php.net/manual/en/function.array-splice.php
array_splice(
// The original $template array
$template,
// The integer value of the price index (such as 2)
$price,
// How many items we want to remove from $template (just 1: the price)
1
);
// Return the price-spliced $template
return $template;
}, 11, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment