Support

Home Forums Ticketing Add-on Custom Ticket Hiding Variables if empty

Custom Ticket Hiding Variables if empty

Posted: January 1, 2014 at 5:55 am

Viewing 3 reply threads


Guy Jackson

January 1, 2014 at 5:55 am

Hi,
I am making a custom ticket template and what I want to do is hide certain variables if they are empty. for example I want to hide the “More Information:” Tag from the venue information if the field is empty. I have been trying to work this out. is it possible?

I have tried to use the standard PHP code in the “index.php” file
if ($venue_description2 != "")echo"<p>More Information: </p>
<p>[venue_description]</p>"; ?>

I have added $venue_description2 = do_shortcode('[venue_description]'); at the beginning of the file.

  • This topic was modified 10 years, 11 months ago by Guy Jackson.


Sidney Harrell

January 1, 2014 at 8:30 am

The ticket shortcodes (and email shortcodes) are not regular WP shortcodes. We do a search and replace for them after the template is loaded. What I would do is change the template to look like this:

[venue_phone]</p>
[venue_description]</p>

and then in plugins/espresso-ticketing/functions.php, line 368, change it to be:

isset($data->event->venue_meta['description']) && !empty($data->event->venue_meta['description']) ? "<p><strong>". __('More Information:', 'event_espresso')."</strong></p><p>".espresso_format_content($data->event->venue_meta['description']) : '',


Guy Jackson

January 1, 2014 at 8:44 am

Thanks for your fast reply, It works perfectly. I have another related question. It probably sounds stupid but its probably because it is past midnight here. How would I implement this to do the same thing with the “Ticket Instructions:” or “Ticket Type:”
Thanks again.


Dean

January 2, 2014 at 12:33 am

Hi,

Ticket Instructiosn:

A similar thing, change the template to look like

[venue_description]

[ticket_content]

and then in plugins/espresso-ticketing/functions.php, line 355, change

espresso_format_content($data->event->ticket_content),

to read

isset($data->event->ticket_content) && !empty($data->event->ticket_content) ? "<p><strong>". __('Ticket Instructions:', 'event_espresso')."</strong></p><p>".espresso_format_content(espresso_format_content($data->event->ticket_content)) : '',

Ticket Type

line 335

$data->attendee->price_option,

to

isset($data->attendee->price_option) ? $data->attendee->price_option : '', 

That should do it, but Ticket Type will always be set (or should be!) so I think this change is moot.

Viewing 3 reply threads

The support post ‘Custom Ticket Hiding Variables if empty’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso