How can I change the phrase "event for 2017" on my my custom text.

Home Forums Calendar Products Events Calendar PRO How can I change the phrase "event for 2017" on my my custom text.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1414238
    hummingpoint
    Participant

    How can I change the phrase “event for 2017” on my event calendar to my custom phrase. For example, “event for 2017 -> my work 2017”

    The last time I asked, I ran only inaccurate information.

    I hope this answer will be clear.

    Event Calendar When I look at monthly mode, I want to change the “event for 12 2017” part at the top.

    Please specify exactly which code you should touch.

    Last time I answered the wrong part of the upcoming event.

    #1414297
    Jennifer
    Keymaster

    Hello,

    I’m sorry you weren’t able to get this working with your last post!

    Using the code in the article that Courtney linked to in your last post, you would want to change the text for the views you want to change, so the text next to $title_month for month view. You can then copy and paste that code (leaving out the opening <?php tag) into the functions.php file of your child theme (you’ll notice that I went ahead and changed month view to “My Work” for you):

    /*
    * Alters event's archive titles
    */
    function tribe_alter_event_archive_titles ( $original_recipe_title, $depth ) {
    // Modify the titles here
    // Some of these include %1$s and %2$s, these will be replaced with relevant dates
    $title_upcoming = 'Upcoming Events'; // List View: Upcoming events
    $title_past = 'Past Events'; // List view: Past events
    $title_range = 'Events for %1$s - %2$s'; // List view: range of dates being viewed
    $title_month = 'My Work %1$s'; // Month View, %1$s = the name of the month
    $title_day = 'Events for %1$s'; // Day View, %1$s = the day
    $title_all = 'All events for %s'; // showing all recurrences of an event, %s = event title
    $title_week = 'Events for week of %s'; // Week view
    // Don't modify anything below this unless you know what it does
    global $wp_query;
    $tribe_ecp = Tribe__Events__Main::instance();
    $date_format = apply_filters( 'tribe_events_pro_page_title_date_format', tribe_get_date_format( true ) );
    // Default Title
    $title = $title_upcoming;
    // If there's a date selected in the tribe bar, show the date range of the currently showing events
    if ( isset( $_REQUEST['tribe-bar-date'] ) && $wp_query->have_posts() ) {
    if ( $wp_query->get( 'paged' ) > 1 ) {
    // if we're on page 1, show the selected tribe-bar-date as the first date in the range
    $first_event_date = tribe_get_start_date( $wp_query->posts[0], false );
    } else {
    //otherwise show the start date of the first event in the results
    $first_event_date = tribe_event_format_date( $_REQUEST['tribe-bar-date'], false );
    }
    $last_event_date = tribe_get_end_date( $wp_query->posts[ count( $wp_query->posts ) - 1 ], false );
    $title = sprintf( $title_range, $first_event_date, $last_event_date );
    } elseif ( tribe_is_past() ) {
    $title = $title_past;
    }
    // Month view title
    if ( tribe_is_month() ) {
    $title = sprintf(
    $title_month,
    date_i18n( tribe_get_option( 'monthAndYearFormat', 'F Y' ), strtotime( tribe_get_month_view_date() ) )
    );
    }
    // Day view title
    if ( tribe_is_day() ) {
    $title = sprintf(
    $title_day,
    date_i18n( tribe_get_date_format( true ), strtotime( $wp_query->get( 'start_date' ) ) )
    );
    }
    // All recurrences of an event
    if ( function_exists('tribe_is_showing_all') && tribe_is_showing_all() ) {
    $title = sprintf( $title_all, get_the_title() );
    }
    // Week view title
    if ( function_exists('tribe_is_week') && tribe_is_week() ) {
    $title = sprintf(
    $title_week,
    date_i18n( $date_format, strtotime( tribe_get_first_week_day( $wp_query->get( 'start_date' ) ) ) )
    );
    }
    if ( is_tax( $tribe_ecp->get_event_taxonomy() ) && $depth ) {
    $cat = get_queried_object();
    $title = '' . $title . '';
    $title .= ' › ' . $cat->name;
    }
    return $title;
    }
    add_filter( 'tribe_get_events_title', 'tribe_alter_event_archive_titles', 11, 2 );

    Let me know if this works!

    #1416032
    Jennifer
    Keymaster

    Hello,

    Following up from this post, since the code is working in my local environment, my first thought is that something was copied differently if you copied and pasted it into your environment and are getting an error. This can happen when copying from sources that are not plain text, and the apostrophe being switched is the most common problem I run into when copying/pasting code in the forums, so I wanted to mention it as something to check.

    If you can send me a copy of your functions.php file (preferably as a gist), I’ll be happy to take a look and see if I can find the source of the error. Please note that we are limited in the amount of support that we can provide for customizations, but I would really like to help you get this working!

    To keep things organized, you can reply directly in this thread – no need to create a new one : )

    Thanks,

    Jennifer

    #1416492
    hummingpoint
    Participant

    Where do I send my functions.php file? Please tell us your email address.

    #1417711
    Jennifer
    Keymaster

    You can actually copy or upload it here as a gist in Github and then paste the link to it in your reply.

    Thanks!

    #1436008
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How can I change the phrase "event for 2017" on my my custom text.’ is closed to new replies.