Want to change headings/titles on Week and Day Views

Home Forums Calendar Products Events Calendar PRO Want to change headings/titles on Week and Day Views

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #123613
    eastbayaa
    Participant

    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.
    Thanks

    #123798
    Barry
    Member

    Hi, 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?

    #123904
    eastbayaa
    Participant

    Hi, 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:
    <?php

    add_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;
    }

    ?>

    #124151
    Barry
    Member

    Sure, 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!

    #124392
    eastbayaa
    Participant

    Ok, 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?

    #125369
    Barry
    Member

    Hi! There is indeed a function called tribe_is_day() – can you give it a try?

    #125411
    eastbayaa
    Participant

    Hmmm, 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 );
    }

    #134949
    Barry
    Member

    This 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!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Want to change headings/titles on Week and Day Views’ is closed to new replies.