Home › Forums › Calendar Products › Events Calendar PRO › Want to change headings/titles on Week and Day Views
- This topic has 7 replies, 2 voices, and was last updated 10 years ago by Barry.
-
AuthorPosts
-
March 26, 2014 at 3:55 pm #123613eastbayaaParticipant
Hello, I’ve watched this video (https://theeventscalendar.com/altering-or-removing-headings-on-calendar-views/) several times which discusses how to change or remove headings/titles on the Upcoming, Map, and Photo views.
I’d like to change the headings on the Week & Day views as well but am unclear what php code would be needed to add to my functions.php override (in my child theme).
In the Week View, I’d like to change “Events for the Week of… ” to “Meetings for the Week of…” and a similar change to the Day View (simply changing the word “Events” to “Meetings”).
Can you please provide me with the php code necessary? I am clear on where to put it.
ThanksMarch 27, 2014 at 8:41 am #123798BarryMemberHi, great question! So instead of this set of conditions:
(tribe_is_upcoming() or tribe_is_map() or tribe_is_photo())
You would only need:
( tribe_is_week() )
(See our tribe_is_week() docs for further details of that function if you need them.) You can then make your change to the title text and perhaps a simple str_replace() would work here along the lines of:
return str_replace( 'Events', 'Meetings', $title );
Does that help?
March 27, 2014 at 12:38 pm #123904eastbayaaParticipantHi, I’m sorry but that doesn’t really help me (I’m a bit of a newbie here). I was hoping you could just provide the snippet of code needed, similar to what is provided for the video example I referenced:
<?phpadd_filter(‘tribe_get_events_title’, ‘change_upcoming_events_title’);
function change_upcoming_events_title($title) {
//We’ll change the title on upcoming and map views
if (tribe_is_upcoming() or tribe_is_map() or tribe_is_photo()) return ‘Upcoming Parties’;//In all other circumstances, leave the original title in place
return $title;
}?>
March 28, 2014 at 7:30 am #124151BarryMemberSure, try something like this:
add_filter('tribe_get_events_title', 'change_week_title'); function change_week_title($title) { if ( ! function_exists( 'tribe_is_week' ) || ! tribe_is_week() ) return $title; return str_replace( 'Events', 'Meetings', $title ); }
Good luck!
March 28, 2014 at 11:35 am #124392eastbayaaParticipantOk, that worked. Thanks! But I also want to do the same for the Day View, but it does not appear that there is a function called ‘tribe_is_day()’ so I’m not clear how I might modify this code to apply to the Day View. Any ideas?
March 31, 2014 at 10:53 am #125369BarryMemberHi! There is indeed a function called tribe_is_day() – can you give it a try?
March 31, 2014 at 11:54 am #125411eastbayaaParticipantHmmm, I did try it before and it broke my site, but I just retried it and it worked! I must have forgotten to change one of the variables. Posting the code snippet here in case it can be of use to someone else:
‘add_filter(‘tribe_get_events_title’, ‘change_day_title’);function change_day_title($title) {
if ( ! function_exists( ‘tribe_is_day’ ) || ! tribe_is_day() ) return $title;
return str_replace( ‘Events’, ‘Meetings’, $title );
}
‘April 17, 2014 at 6:45 am #134949BarryMemberThis thread’s not seen much activity for the last couple of weeks so I’ll go ahead and close it. Of course if you still need help with this or any other issue please don’t hesitate to create a new thread (or threads) and one of the team will be only too happy to help. Thanks!
-
AuthorPosts
- The topic ‘Want to change headings/titles on Week and Day Views’ is closed to new replies.