Tribe__Tickets__Attendee_Registration__Template::set_page_template( string $template )
Set the theme page template we’re going to use for the attendee-registration page
Contents
Parameters
- $template
-
(string) (Required) The AR template.
Return
(void)
Source
File: src/Tribe/Attendee_Registration/Template.php
public function set_page_template( $template ) {
// Bail if we're not on the attendee info page
if ( ! $this->is_on_ar_page() ) {
return $template;
}
// Use the template option set in the admin
$template = tribe_get_option( 'ticket-attendee-info-template' );
if ( empty( $template ) ) {
// we should only get here if the value hasn't been set yet
$template = 'default';
} elseif ( 'same' === $template ) {
//note this could be an empty string...because.
$template = tribe_get_option( 'tribeEventsTemplate', 'default' );
}
if ( in_array( $template, array( '', 'default' ), true ) ) {
// A bit of logic for themes without a page.php
$template = 'page.php';
if ( ! locate_template( $template ) ) {
$pages = array_keys( wp_get_theme()->get_page_templates() );
if ( ! empty( $pages ) ) {
$template = $pages[0];
}
}
}
// If template is not found, use default.
if ( ! locate_template( $template ) ) {
$template = 'index.php';
}
$template = locate_template( $template );
/**
* Use `tribe_tickets_attendee_registration_page_template` to modify the attendee registration page template.
*
* @since 4.10.1
*
* @param string $template The current attendee registration page template.
*/
$template = apply_filters( 'tribe_tickets_attendee_registration_page_template', $template );
return $template;
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |