Tribe__Events__Community__Tickets__Main::maybe_enqueue_frontend()

Enqueue the front end resources, add nonces for forms

Topics


Source #

File: src/Tribe/Main.php

	public function maybe_enqueue_frontend() {
		$nonces = array(
			'add_ticket_nonce'    => wp_create_nonce( 'add_ticket_nonce' ),
			'edit_ticket_nonce'   => wp_create_nonce( 'edit_ticket_nonce' ),
			'remove_ticket_nonce' => wp_create_nonce( 'remove_ticket_nonce' ),
			'ajaxurl' => admin_url( 'admin-ajax.php' ),
		);

		wp_localize_script( 'events-community-tickets', 'TribeTickets', $nonces );
		wp_localize_script( 'events-community-tickets', 'ajaxurl', admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ) );

		if ( ! tribe_is_community_my_events_page() && ! tribe_is_community_edit_event_page() ) {
			return;
		}

		if ( ! is_admin() ) {
			// enqueue the styles so our page nav looks ok
			wp_enqueue_style( 'events-community-tickets' );
		}
	}