Displaying Upcoming Category Events in Menu

Home Forums Calendar Products Events Calendar PRO Displaying Upcoming Category Events in Menu

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #891051
    Mike
    Participant

    I asked this question a couple months ago (http://bmo.re/1vqpeJF) and got a great response from Brian. My problem isn’t resolved so I’m hoping to revisit it.

    I’m using an additional plugin called “Category Posts in Custom Menu” (http://bmo.re/YarXI5) to list the events that are within a certain Category (‘Featured’), as menu items.

    This plugin is really aimed for Posts and Categories of Posts but Events shouldn’t be different. The problem I’m facing is that Tribe is setting some sort of global filter that hides event that have already passed. This is fine, except that filter seems to not engage when I’m on a single event page.

    Brian’s response was:

    “I can help give you some information on the global filter/function of some sort that will hide “past events” from a query.
    Our queries to get events include this:
    'eventDisplay' => 'upcoming'
    That is our argument to only get upcoming events. You can use ‘past’ and ‘all’. Since that is done in a query it is not used on the Single Events Template.”

    Since the problem is occuring in my nav menu (Header.php), I don’t know how the Single Events Template would affect this. It shows correctly on my homepage (http://bmo.re/1uSo73W) and it shows incorrectly on a single event page (http://bmo.re/1qtQCp3)

    Any help here? Thanks!

    #892057
    Brian
    Keymaster

    Hello Again.

    Glad I could help a little, lets see if we can get this resolved all the way now.

    First we have depreciated ‘eventDisplay’ => ‘upcoming’ in favor of:

    ‘eventDisplay’ => ‘list’

    For all future events.

    So these two events are showing in the dropdown on single events:

    Economic Outlook Conference
    MEDA 2014 Fall Conference

    And since they are past Events you would not like them to show, correct? And they only show on the Single Events Page.

    How about changing the coding outlined above and get back to me then I can take another look at this and see if I can come up with something.

    Thanks

    #892127
    Mike
    Participant

    Thanks for your help Brian.

    I’m not using any query for the dropdowns. (‘eventDisplay’ => ‘upcoming’ nor ‘eventDisplay’ => ‘list’). I’m using the ‘Category Posts in Custom Menu’ plugin which is doing its own query and grabbing the events (posts) associated with a category I’ve selected for that dropdown. Since it’s not using the eventDisplay parameter, where else would eventDisplay be queried on other pages that it’s not being called on single events?

    I looked at my homepage template and saw that I, in fact, am querying events for the section of that page that’s titled “Upcoming Events”. That query looks like this:

    $args = array(
    'post_status'=>'publish',
    'post_type'=>array(TribeEvents::POSTTYPE),
    'posts_per_page'=>3,
    'meta_key'=>'_EventStartDate',
    'orderby'=>'_EventStartDate',
    'order'=>'ASC',
    //required in 3.x
    'eventDisplay'=>'upcoming'
    );

    I changed ‘eventDisplay’ from ‘upcoming’ to ‘past’ to see if that had an effect on menu, but it did not. It showed past events in the body of the homepage, but upcoming events in the menu.

    #893644
    Brian
    Keymaster

    Ok so not sure what is wrong on that page. I am unable to do to much with compatibility with a 3rd party plugin.

    However, I came up with a snippet that on I placed in the Category Menu Plugin that worked me in only getting Events from today or in the future.

    Here is a link to it:

    https://gist.github.com/jesseeproductions/bc93ca1e5edfa1f732e4

    It has instructions where to place it in the Category Menu Plugin. There was not hooks or filters I saw to add it in that way so I just added the coding according to the instructions in the snippet.

    That should get you close, you may have to play around with it some more get it how you would like.

    Thanks

    #893822
    Mike
    Participant

    Brian, you are awesome! That did the trick.
    I owe you either a very cold beer or a warm cider, depending on where you are currently located.

    Thanks!

    #894084
    Brian
    Keymaster

    Beer is always good, next time you are in DC 🙂

    Glad it helps, I am going to go ahead and close this ticket, but if you need any other on something else please post a new ticket.

    Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Displaying Upcoming Category Events in Menu’ is closed to new replies.