Support

Home Forums Event Espresso Premium Override Ticket Selector Template

Override Ticket Selector Template

Posted: August 3, 2017 at 5:18 am

Viewing 4 reply threads


George

August 3, 2017 at 5:18 am

Hello,

I want to override the ticket selector template so i can include theme specific style classes and resturcture its layout.

I saw in this post: https://eventespresso.com/topic/ticket-selector-customization-or-better-look-feel/, that it can be done using filters apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );.

I dont quite understand its usage…Should i replace $templates['ticket_selector'] with the URL of my custom template?

Please explain how i can do this. Thanks


Tony

  • Support Staff

August 3, 2017 at 6:04 am

Hi there,

As mentioned in the other thread you linked to, there is a lot of logic within the ticket selector so we advise against modifying its templates, if you do you’ll nee dot make sure you carry over any changes we make to the default template to your custom template.

The templates for the ticket selector can be copied to your themes root directory (I’d recommend creating a child theme if you are not using one already).

Or if you prefer to use the filter mentioned above you need to add your own function that returns the full file path for the template you are editing. The filter provided to change the path is expected to be used by developers, it’s a standard WP filter hook:

https://www.smashingmagazine.com/2016/01/get-started-with-hooks-wordpress/


George

August 3, 2017 at 8:04 am

Hi,

Yes i understand I’ll have to update the modified files with changes when you guys make changes to it.

I tried the code you suggested in the other post but its not working…
This is what i did in my functions.php to use the templates i copied to my child theme:

$templates['ticket_selector'] = get_stylesheet_directory_uri() . '/espresso/ticket_selector/templates/';
apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );

I get this error:

[03-Aug-2017 13:49:01 UTC] PHP Fatal error:  Uncaught Error: Cannot access self:: when no class scope is active in /home/manndi93/public_html/wp-content/themes/hue-child/addon_eventespresso_functions.php:256
Stack trace:
#0 /home/manndi93/public_html/wp-content/themes/hue-child/functions.php(7): require_once()
#1 /home/manndi93/public_html/wp-settings.php(422): include('/home/manndi93/...')
#2 /home/manndi93/public_html/wp-config.php(157): require_once('/home/manndi93/...')
#3 /home/manndi93/public_html/wp-load.php(37): require_once('/home/manndi93/...')
#4 /home/manndi93/public_html/wp-admin/admin-ajax.php(22): require_once('/home/manndi93/...')
#5 {main}
  thrown in /home/manndi93/public_html/wp-content/themes/hue-child/addon_eventespresso_functions.php on line 256

Obviously, im doing something wrong. Please can you share a sample code i should put in my functions.php so that it will use the templates i have copied to my child theme?

Thanks.


Josh

  • Support Staff

August 3, 2017 at 8:55 am

Hi George,

The Smashing Magazine article that Tony linked to is loaded with sample code that shows how to use add_filter() and they do a much better job of explaining how to use that function than we could.


George

August 3, 2017 at 9:09 am

Yes Josh…Sorry, i was doing it wrong.

Viewing 4 reply threads

The support post ‘Override Ticket Selector Template’ 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