Home › Forums › Calendar Products › Events Calendar PRO › Change title of "This Week" widget
- This topic has 6 replies, 3 voices, and was last updated 9 years, 7 months ago by
Jonathan Vogel-Borne.
-
AuthorPosts
-
October 6, 2016 at 8:24 pm #1173565
Jonathan Vogel-Borne
ParticipantThe article about how to add code to the themes functions.php to change the titles of the various calendars and events is very helpful and I have used it with success.
I am now trying to change the title of the “This Week” widget from “Events for week of…” to “Calendar for the week of…” and cannot find the place in the code where the text string for this title is specified. The line of code in the this-week-widget.php that refers to the title is:
php echo esc_html( tribe_events_get_this_week_title( $this_week_template_vars[‘start_date’]
Please help me find the referenced text string.
Thank you for your help here.
Jonathan Vogel-Borne
October 7, 2016 at 1:40 pm #1173892Andras
KeymasterHey Jonathan,
Thanks for going Pro and welcome to the forums! Let me help you with that question.
You need to create a template override of this file:
wp-content\plugins\events-calendar-pro\src\views\pro\widgets\this-week-widget.php
Copy that file to this folder:
wp-content\themes\{your-theme}\tribe-events\pro\widgets\this-week-widget.php
The line you will need to edit is line 21, which looks like this:
<h2 class="tribe-events-page-title"><?php echo esc_html( tribe_events_get_this_week_title( $this_week_template_vars['start_date'] ) ); ?></h2>And I think the function you will need to use to get the first day of the week is tribe_get_this_week_first_week_day().
https://theeventscalendar.com/function/tribe_get_this_week_first_week_day/Here are some more resources that might help you:
https://theeventscalendar.com/knowledgebase/themers-guide/
https://theeventscalendar.com/knowledgebase/template-overview/I hope this helps. Let me know how far you get!
Cheers,
AndrasOctober 8, 2016 at 1:47 pm #1174133Jonathan Vogel-Borne
ParticipantThank you for the András…
Though you have not answered my question. I want to change the text string of the widget title from “Events for week of…” to “Calendar for the week of…”. Through the article referenced in my earlier post, I have been able to change the text strings for the titles on the month view and week view and upcoming events titles for other segments of the calendar, but not yet on the widget.
Again thank you for your help here.
Jonathan
October 10, 2016 at 10:08 am #1174551Andras
KeymasterHey Jonathan,
I’m sorry for the confusion here. Let me try to clarify.
The text string of the widget title you quoted cannot be changed as the article suggests. The reason for that is that the whole string is put together in a function including the date of the first day of the current week, thus that string changes all the time. That is why it needs to be changed via overriding the template of the widget.
To get the result you desire, you will need to create the template override. Copy the file as instructed above. Then open the new file for editing and Replace lines 20-22 with this:
https://gist.github.com/andrasguseo/ee3c79b7091a6e7bbb36ca5287575d74
That should give you what you need.
If you would like to change the format of the date, then you can change the format in the code according to this:
http://php.net/manual/en/function.date.phpLet me know how this works out.
Cheers,
AndrasOctober 12, 2016 at 11:08 am #1175533Jonathan Vogel-Borne
ParticipantGreetings András,
Thank you so much. This is exactly what I needed. Works perfectly.
Jonathan
October 13, 2016 at 1:52 am #1175800Andras
KeymasterHello Jonathan,
Great, glad it helped! I am going to go ahead and close this ticket, but if you need help on this or something else, don’t hesitate to open a new topic.
Cheers,
AndrasPS: If you like our plugin, and you didn’t do so yet, we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/view/plugin-reviews/the-events-calendarPS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
AuthorPosts
- The topic ‘Change title of "This Week" widget’ is closed to new replies.
