Home › Forums › Calendar Products › Events Calendar PRO › Modify Widget Text When No Upcoming Events
- This topic has 6 replies, 2 voices, and was last updated 12 years ago by
Barry.
-
AuthorPosts
-
March 5, 2014 at 8:11 am #113061
Sonya Mowery
ParticipantI want to slightly change the text that appears in the widget when there are no upcoming events. I want to be able to point users to past events with a link. I’m sure I could poke around and modify the plugin but my concern is that any changes I make will be overwritten with updates to the plugin. What is the best way to approach this?
March 5, 2014 at 9:05 am #113325Barry
MemberTemplate overrides!
Whether your theme is a likely to be subject to updates from an external source of not (such as if you bought one or sourced one from wordpress.org and will be keeping it updated) will dictate where exactly you place the overrides – you might place them in a child theme for instance – but in general, that’s the way to go.
Please see: Themer’s Guide.
I hope that helps!
March 5, 2014 at 10:14 am #113407Sonya Mowery
ParticipantIt appears though this message is created through the events-list-widget.class.php file not a view file.
March 6, 2014 at 7:57 am #115770Sonya Mowery
ParticipantSo how do you handle overrides for .class.php files? See my post above.
March 6, 2014 at 10:43 am #115844Barry
MemberHi!
If the text you wish to modify is in the widget class itself, then there are a few options open to you:
- If you don’t wish to replace the text, but instead want to add to it, you could leverage the tribe_events_after_list_widget action hook to do so
- The there are no upcoming events at this time message is translatable – so setting up a custom translation for that string is another possibility, as is leveraging the gettext filter hook
- You could define a new class inheriting from the existing one defined in our plugin, change only what you need to change in the child class, and register it as a new widget
So there are different ways to tackle it (you could also add and make use of output buffering via various other actions and modify the result) and the best approach is really going to depend on what you are most comfortable with.
I hope that helps!
March 7, 2014 at 4:58 am #116155Sonya Mowery
ParticipantThanks for the response Barry! Yes I feel confident I can take it from here.
April 21, 2014 at 7:44 am #138339Barry
MemberClosing this thread as it’s been quite a while – of course if we can help with anything else please do create a new thread. Thanks!
-
AuthorPosts
- The topic ‘Modify Widget Text When No Upcoming Events’ is closed to new replies.
