Created
November 16, 2022 22:18
-
-
Save lelandf/8f213b4b84402bd7da01c6dc7a4aeed3 to your computer and use it in GitHub Desktop.
[TEC] Remove price block from Event bock template
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_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