A default image for the ticket header if none is selected?

Home Forums Ticket Products Event Tickets Plus A default image for the ticket header if none is selected?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #952576
    James O’Sullivan
    Participant

    Hi there, on the Ticket section of the single Events page (the admin side) there is a place to input the “Upload image for the ticket header” element. I basically want the same header image across the board and dont need to upload this every single time. I would like to streamline this a little and just have a default image in place as the header. how would I make sure it defaults to a specific image if none is inserted? Thanks in advance for your time.

    #952652
    Barry
    Member

    Hi James,

    Great question.

    The first thing to look at here is our Themer’s Guide which covers the basic steps needed to safely override and customize our plugin templates.

    In this case you will probably be interested in overridding the tickets/email.php template (actually found within The Events Calendar’s views directory, rather than within WooCommerce Tickets itself). Around lines 280-293 – depending on the version you are working with – you should see these lines:

    <?php if ( ! empty( $header_img ) ) {
    	$header_width = esc_attr( $header_img[1] );
    	if ( $header_width > 580 ) {
    		$header_width = 580;
    	}
    	?>
    	<table border="0" cellpadding="0" cellspacing="0" width="100%">
    		<tr>
    			<td class="ticket-image" valign="top" align="left" width="100%" style="padding-bottom:15px !important;">
    				<img src="<?php echo esc_attr( $header_img[0] ); ?>" width="<?php echo $header_width; ?>" alt="<?php echo esc_attr( $event->post_title ); ?>" style="border:0; outline:none; height:auto; max-width:100%; display:block;" />
    			</td>
    		</tr>
    	</table>
    <?php } ?>

    Within your custom version, immediately prior to this section, you could add some code along these lines:

    if ( empty( $header_img ) ) {
        $header_img = 'example.com/preferred-ticket-header.jpg';
    }

    This would then allocate an image URL of your choosing to the ticket header (but only if not specified for the event in question).

    Does that help?

    #956652
    Barry
    Member

    Hi!

    It’s been a while so I’m going to go ahead and close this topic.

    • Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
    • Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘A default image for the ticket header if none is selected?’ is closed to new replies.