404 page not found on all venue pages

Home Forums Calendar Products Events Calendar PRO 404 page not found on all venue pages

  • This topic has 9 replies, 3 voices, and was last updated 7 years ago by Ryan Duval.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1257311
    Ryan Duval
    Participant

    It appears it may be a theme conflict- I’m running Avada 4.0.3, and when I switched over to WP 2015, the Venue page appeared. But I’d be surprised if it was simply a theme conflict, since Avada is so widely used- I feel I would have seen this in the forums already. Everything I’ve found from the last year hasn’t been able to fix my issue (yes I flushed the permalinks). Everything else works fine, it’s just the front-end venue pages. I just updated Event Calendar, so it’s the latest version, still no luck. Any tips on how to troubleshoot this would be appreciated.

    thanks!

    #1257825
    Geoff B.
    Member

    Good evening Ryan and welcome back!

    Thank you for reaching out to us.

    We are sorry to hear about the venue pages not displaying on your website. Yikes!
    I would love to help you with this topic.

    Based on the information provided so far, it looks like you might be the victim of some type of conflict or version mismatch.

    The possible causes are:

    1. The version of Avada you are using (the current version is 5.1.4)
    2. The content of your Avada Child Theme
    3. The version of the Events Calendar you are using

    I am not sure if you are aware of this, but Avada contains customizations to integrate our plugins.

    Of course, as our code changes, so does the code contained in the customization of Avada.

    This also means that to work hand-in-hand the theme version and our plugins version need to match in time.

    For example Avada 4.0.3 dates from June 2016. This means that it will work best with version 4.2.x of our plugins.

    This also applies to the compatibility with our own plugins. To ensure proper functioning, it is highly recommended to have “matching versions” (issued at around the same time).

    All that being said, I believe that if you downgrade all our plugins to version 4.2.x or if you upgrade Avada to a version that matches your plugins, the issue should go away.

    I can help you with that if you need me too.

    Let me know if that helps.

    Have a great day!

    Geoff B.

    #1257960
    Ryan Duval
    Participant

    Hi Geoff,
    Thanks for the help- I think the best way for me at the moment would be to downgrade all of my Event Calendar plugins to a compatible version with my currently working theme. If you can point me in the right direction to do that without messing up currently existing events, I’d really appreciated it!

    #1258489
    Geoff B.
    Member

    Good evening Ryan,

    Thank you for writing back.

    I recommend reading the following: https://theeventscalendar.com/knowledgebase/downgrading-plugin-past-version/

    In other words, it is recommended to make a complete database backup to be safe, but you should be able to deactivate and delete your current plugins without impacting the existing events.

    Let me know how that goes.

    Best regards,
    Geoff B.

    #1258717
    Ryan Duval
    Participant

    Hi Geoff,
    I downgraded the event calendar plugin to version 4.2.7, so now my Event Calendar plugins are in the 4.2._ versions, but still all of my venue pages go to a 404 page. I checked through any custom code I added in the child theme, and was actually able to narrow down the problem to this bit of code I added in functions.php:

    /** from https://theeventscalendar.com/support/forums/topic/how-to-hide-past-events/  **/
    add_filter('tribe_events_pre_get_posts', 'filter_tribe_all_occurences', 100);
    
    function filter_tribe_all_occurences ($wp_query) {
            if ( !is_admin() )  {
     
                    $new_meta = array();
                    $today = new DateTime();
                    $start_date =  tribe_get_start_date( null, false, 'Y-m-d H:i:s' ); // 'Y/m/d'
                    $today->setTimezone(new DateTimeZone('America/Los_Angeles'));
    
                    //-RD display current events where start date is less than one week before today
                    $week_past_start_date = date('Y-m-d H:i:s', strtotime($start_date. ' - 7 days'));
    
                    // Join with existing meta_query
                    if(is_array($wp_query->meta_query))
                            $new_meta = $wp_query->meta_query;
     
                    // Add new meta_query, select events ending from now forward
                    $new_meta[] = array(
                            'key' =>  _EventStartDate,
                            'type' => 'DATETIME',
                            'compare' => '>=',
                            'value' => $week_past_start_date
                            // original code:  'value' => $today->format('Y-m-d H:i:s') 
                    );
                    $wp_query->set( 'meta_query', $new_meta );
            }
            return $wp_query;
    } 

    I do need the functionality this code provides (it hides events that are ongoing, but already started over a week ago), but it appears that commenting out this code makes the venue pages appear just fine. I’m not sure why this would impact the venue pages, but somehow it does.

    Is there a better way to achieve my goal of hiding currently-in-process events that began over a week ago, that won’t cause all the venue pages to show 404 not found?

    thanks,
    Ryan

    • This reply was modified 7 years ago by Ryan Duval.
    #1259361
    Geoff B.
    Member

    Good evening Ryan,

    Nice troubleshooting!

    Just to set expectations, as you might know, the scope of our support is mostly to get our customers started on the right track and to help them in case of issues.

    We unfortunately do not provide complete support for customization.

    With that in mind, I will still ask our coding wizards to see if they can provide some insight on this.

    Hang in there as I do that for you

    Best regards,

    Geoff B.

    #1259532
    Geoff B.
    Member

    Good morning Ryan,

    As promised, I ran this by our coding staff and here is their answer.

    'key' => _EventStartDate,

    PHP is so kind, this would probably work (albeit it ought to throw a notice or warning) – it ought to be:

    'key' => '_EventStartDate', (strings should be quoted)

    and second, that change he is making is touching the main query for the venue page (ie, the venue query itself)

    venues don’t have start dates/times, only the events they might be associated with do … so by filtering to venues with an event start date he’s effectively stopping WordPress from locating the correct venue (edited) which is the real cause of the 404

    here’s what I’d suggest he do to avoid this: at the top of the method, add an extra check against $wp_query->get( 'post_type' ) and confirm the query relates to _events_ and bail out if it doesn’t

    Let me know if that helps.

    Have a great day!

    Geoff B.

    #1259585
    Ryan Duval
    Participant

    Thanks Geoff & the coding staff, that seemed to do the trick!
    Would not have figured that one out on my own.

    cheers,
    Ryan

    #1259976
    Geoff B.
    Member

    Good afternoon Ryan,

    I am super stoked that this did the trick for you.

    You are welcome back in our support forums any time 🙂

    For now, I am going to close this thread.

    Have a great week!

    Geoff B.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘404 page not found on all venue pages’ is closed to new replies.