Renaming Events Views Problem

Home Forums Calendar Products Events Calendar PRO Renaming Events Views Problem

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1279200
    Marion
    Participant

    This issue seems to have been flagged back in Jan 2016 but I cannot find any resolution.

    I followed suggested code to change the name of Photo View to Poster. However when I am in other views (eg. month or list) and I select “Poster” the link is still set to /photo and I get a 404 error. Here is the code I used.

    // We want to adapt the names of views listed within the Tribe Events Bar
    add_filter( ‘tribe-events-bar-views’, ‘rename_tribe_views_in_selector’, 100 );

    function rename_tribe_views_in_selector( $views ) {
    // This lists the original view names you wish to change along
    // with the substitutes to wish to use in their place
    $to_change = array(
    ‘List’ => ‘List’,
    ‘Month’ => ‘Month’,
    ‘Photo’ => ‘Poster’,
    );

    // Look through the list of active views and modify names accordingly
    foreach ( $views as &$view )
    if ( isset( $to_change[ $view[‘anchor’] ] ) )
    $view[‘anchor’] = $to_change[ $view[‘anchor’] ];

    // Return our revised list
    return $views;
    }

    /**
    * Modify the “bases” used to form event URLs for various views.
    *
    * @param array $bases
    *
    * @return array
    */
    function rename_event_view_slugs( $bases ) {
    if ( isset( $bases[‘month’] ) ) $bases[‘month’] = [ ‘month’, ‘month’ ];
    if ( isset( $bases[‘list’] ) ) $bases[‘list’] = [ ‘list’, ‘list’ ];
    if ( isset( $bases[‘photo’] ) ) $bases[‘photo’] = [ ‘poster’, ‘poster’ ];
    return $bases;
    }
    /**
    * Wire up our code used to modify event slugs in the rewrite rules.
    */
    add_filter( ‘tribe_events_rewrite_base_slugs’, ‘rename_event_view_slugs’, 20 );

    #1280655
    Geoff B.
    Member

    Good evening Marion and welcome back!

    Thank you for reaching out to us.

    We are sorry to hear about the issues you have met while attempting to implement the suggestions found here: https://theeventscalendar.com/knowledgebase/renaming-views/

    I would love to help you with this topic.

    You are absolutely right. Although the first snippet works like a charm, the second one (that deals with URL rewrites needs to be improved.

    I will flag this for repair.

    We apologize for the inconvenience caused by this glitch.

    Alas, I cannot guarantee when it will be fixed, as it’s in the development team’s hands now.
    They need to assign it, code it, test it, and schedule it for release.

    The good news is that you will be contacted as soon as a fix is available.
    Thank you for your patience as we see this through.

    Best regards,
    Geoff B.

    #1280862
    Marion
    Participant

    I was able to reset my bases back to the default but with some difficulty. After changing the code in functions.php I had to uncheck that base option in the settings and then add it back in. Otherwise the change in the code did not take. Since this is a known bug you might want to make a note of it in the code snippet so that other people don’t continue to encounter the bug.

    Thanks,

    Marion

    • This reply was modified 8 years, 11 months ago by Marion.
    #1281445
    Geoff B.
    Member

    Good evening Marion,

    I actually have good news.

    As it turns out, the suggestions do work. However, you also need to add the 3rd snippet found at the bottom of that page for things to work: https://theeventscalendar.com/knowledgebase/renaming-views/ ( https://gist.github.com/theeventscalendar/617db40637a4b352174e#file-filter-for-new-slug-names-php )

    In other words, we were both 2/3 of the way there and we missed that last snippet.

    Give it a shot and let me know how that goes.

    Best regards,

    Geoff B.

    #1291364
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Renaming Events Views Problem’ is closed to new replies.