Created
May 29, 2019 15:13
-
-
Save skyshab/0e4ea8a1955dcd6e9ca2703aa9b1ef7f to your computer and use it in GitHub Desktop.
Custom Block editor template for event with tickets
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 | |
// Return a custom order of the default blocks on an event. | |
// to change the order of the blocks, arrange the lines the blocks are added to the array. | |
// To remove a block from being added by default, comment out the line for the block. | |
add_filter( 'tribe_events_editor_default_template', function( $template ){ | |
// initiate our array | |
$template = array(); | |
// default blocks | |
$template[] = array( 'tribe/event-datetime' ); | |
$template[] = array( | |
'core/paragraph', | |
array( | |
'placeholder' => __( 'Add Description...', 'the-events-calendar' ), | |
), | |
); | |
$template[] = array( 'tribe/event-price' ); | |
$template[] = array( 'tribe/event-organizer' ); | |
$template[] = array( 'tribe/event-venue' ); | |
$template[] = array( 'tribe/event-website' ); | |
$template[] = array( 'tribe/event-links' ); | |
// tickets blocks | |
$template[] = array( 'tribe/tickets' ); | |
$template[] = array( 'tribe/rsvp' ); | |
$template[] = array( 'tribe/attendees' ); | |
// return the array of blocks with our custom order. | |
return $template; | |
}, 500); | |
// Prevent tickets from being added again by the plugin. We've already added them in the order we want. | |
remove_action( 'admin_init', array( tribe( 'tickets.editor' ), 'add_tickets_block_in_editor' ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This is more or less what i'm looking for, only I can't figure out where I should put this php file.
Can you guide me into the right direction?
functions.php?