Extend TribeEventsTemplates class
-
Hello everyone.
I’ve been trying for the past few days to extend the TribeEventsTemplates Class in order to overwrite the get_current_page_template() function inside of it.
My task is actually really simple: I need to add an If statement inside of the function to show to the users different templates (grid or list) depending by the device.
Unfortunately, being poorly skilled with PHP, I’m stuck in what seems actually a very basic problem.
I wrote an email to Modern Tribe Support and they kindly and quickly (great service there guys) pointed me in the good direction, saying:
Regarding extending TribeEventsTemplates: you can certainly override static methods (unless they are declared final, which I don't think any are) but any overriding methods will be unable to directly access private methods in the base class - which may or may not pose a problem, depending on what you are trying to do.No need to say (again) that half of this is out of my faculties.
Since the most asked question in Support thread is “where’s the code?”, here is what I tried:class TribeEventsTemplates_new extends TribeEventsTemplates { public static function get_current_page_template() { // function code } }It does nothing at all.
I would be very glad in any of you could get me out of this. Thank you in advance for your help.Matt
The topic ‘Extend TribeEventsTemplates class’ is closed to new replies.