WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] filter events returned on EM_Events::output (11 posts)

  1. funmusic
    Member
    Posted 1 year ago #

    Hi,

    I'm trying to modify the template calendar-full.php so it only shows the events that can be booked (that is future events, and also that have tickets left).

    I am using this function

    echo EM_Events::output($cell_events,array('scope'=>'future', 'format'=>"
    <li><a>ID}\">#_24HSTARTTIME</a></li>
    "));

    But scope => future isn't working. What am I doing wrong? And also, how do I filter only events that have tickets left?

    Also ignore the 'format' key if it is irrelevant, I am using it to modify the url, I put the line exactly as it is on the source.

    Thanks.

    http://wordpress.org/plugins/events-manager/

  2. funmusic
    Member
    Posted 1 year ago #

    I'll put again the code, because it got broken on my first post:

    echo EM_Events::output($cell_events,array('scope'=>'future', 'format'=>"<li><a href=\"#_EVENTURL?cid={$post->ID}\">#_24HSTARTTIME</a></li>"));

  3. philipjohn
    Member
    Posted 1 year ago #

    Hiya,

    That code should show all future events, but I don't see anything in there to change whether to show those with bookings available.

    How have you tried to exclude events without tickets available?

    Thanks,
    Phil

  4. Fixed.

    Please use the CODE button to wrap your code when you post it, otherwise it gets mangled, as you saw :)

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    thx Mika! damn you're fast....

  6. funmusic
    Member
    Posted 1 year ago #

    Hi, with that code, the calendar shows future, present and past events. I don't know how to filter events that are booked. It is a bit wierd that by default the calendar shows fully booked events. If there isn't an option to filter that on the output function or on the calendar shortcode, maybe should I filter that events on the full-calendar.php template not inserting them on $cell_events array?

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    there isn't a filter for this, you'd need to loop through results and check if something is fully booked or not, it can't be done in a db query.

  8. funmusic
    Member
    Posted 1 year ago #

    Ok, thanks, but what about showing only events in the future? It is not that important because the calendar shows the current day in other color, but should the above code work?, because it doesn't for me.

  9. angelo
    NetWebLogic Support
    Posted 1 year ago #

    hi,

    try to use conditional placeholder at Events > Formatting > Calendar > Event format

    e.g.

    {is_future}<li>#_EVENTLINK</li>{/is_future} {is_past}<li><a href="#_EVENTURL">#_EVENTNAME</a> </>{/is_past}
  10. funmusic
    Member
    Posted 1 year ago #

    I think I can't use the wp-admin options to change the event format, because I need to modify the event link as shown in:

    <a href=\"#_EVENTURL?cid={$post->ID}\">

    I am passing a GET parameter cid (where did the user come from), because I am using this info on the booking page. And I don't have that parameter on the wordpress admin page.

  11. philipjohn
    Member
    Posted 1 year ago #

    As Marcus said, you're probably going to have to get these results for use with PHP and loop through them rather than trying to use the normal formats settings.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic