No, the month display does not mean it’s a post type archive

Home Forums Calendar Products Events Calendar PRO No, the month display does not mean it’s a post type archive

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #56847
    Grégory
    Participant

    Hi (again).

    /the-event-calendar/lib/tribe-event-query.class.php, line 55:
    public function parse_query( $query ) {
    if ($query->get(‘eventDisplay’) == ‘month’) {
    // never allow 404 on month view
    $query->is_post_type_archive = true;
    }
    return $query;
    }

    No, you’re doing it wrong. (what about taxonomy archive?)

    #56936
    Barry
    Member

    Hi Grégory,

    No, you’re doing it wrong. (what about taxonomy archive?)

    Thanks for the feedback – which I’d be happy to pass along to the developers. Can you be a little clearer though about why this is a problem for you and why you feel it is incorrect?

    #56939
    Grégory
    Participant

    Hi Barry, thanks for your answer.

    The month display can be used for the whole calendar, or for the ‘tribe_events_cat’ archive (when you display events of a specific category).
    The code above forces $query->is_post_type_archive to true when the view is ‘month’, even when the ‘tribe_events_cat’ archive is displayed.
    Lots of filters use this state ($query->is_post_type_archive = true) and as a result, return wrong data.
    Few examples:
    – is_post_type_archive() will return true, and shouldn’t.
    – the filter ‘post_type_archive_title’ will be triggered, and shouldn’t.
    – in a real post type archive, get_queried_object() contains a post type object. In this case it will contain the taxonomy term array (same problem for get_queried_object_id() of course).
    – etc.

    Sorry if I was a bit harsh with my previous post(s), I know it’s a major release and it always comes with bugs, and you are doing your best, as fast as you can. But the deadline for the website I’m building is approaching very quickly and I’m feeling like losing my time, fixing bugs.

    Regards.
    Greg

    PS: in my case anyway, removing the filter solved my problem.

    #56959
    Barry
    Member

    OK, well I’ll certainly forward your response to the dev team: my own assumption was that even when a specific category is not being viewed it remains a (date-based) archive of (custom) posts, but I can see it may be more nuanced and one might hit difficulties based on what you have said here.

    Sorry if I was a bit harsh with my previous post(s)

    No worries, we’re receptive to criticism and it will drive the quality of the plugin higher as we progress. Thanks for your continued patience and support 🙂

    #58010
    Rob
    Member

    Hey again Gregory! Just wanted to follow-up on this, now that we’ve had a chance for our lead developer Jessica to take a look at and attempt to engage with your point here. Looks like this is going to lead to some changes in our codebase in an impending release.

    This was the best way she came up with to ensure the month view never returns as a 404, which was happening when there are no events in the month. was to make one of these returns true (in order to avoid the 404):

    * is_tag()
    * is_category()
    * is_tax()
    * is_author()
    * is_post_type_archive()

    Post type archive seemed like the best option out of all of those, since any view of the events could technically be considered an archive view of the tribe_event post type.

    In terms of what we’re looking to do for the future release: potentially we could check first to see if any of the other conditionals above would return true on their own, and/or check if there are actually no events (which would cause a 404), instead of just always setting is_post_type_archive() to true. Not sure which route we’ll take but know the ball is rolling here.

    Thanks for your patience on this end so far. If you have other questions or if I missed anything here, let me know.

    #58041
    Grégory
    Participant

    Hi Rob, thanks for your answer.

    Since I don’t get any 404 (I made lots of changes so…), this code is not tested, but it should do the trick I think: http://pastebin.com/qumtFVk3

    “Thanks for your patience on this end so far.”
    No problem, I do my stuff myself, I can’t stay put 🙂

    BTW, I saw that the url for the iCal link is always the same, whatever we’re seeing a category, a tag, a single event, and whatever the view.
    So… http://pastebin.com/2huAPHyv (the version I use for my client is a bit different but it works, I guess this one should too). Maybe some new rewrite rules are needed for this to work, I’ve added a few ones for my needs.

    Cheers.
    Greg

    #58559
    Rob
    Member

    This is excellent! I’m actually remarking yours as the answer for now 🙂 Thanks Gregory.

    #58562
    Grégory
    Participant

    You’re welcome 🙂
    Warn: there’s a missing closing parenthesis in my function get_ical_link() (a non-closing empty() :s).

    #60777
    Rob
    Member

    Re-closing this one.

    #980150
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘No, the month display does not mean it’s a post type archive’ is closed to new replies.