WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Custom search attribute not working with [events_calendar] (12 posts)

  1. Jpyper
    Member
    Posted 2 years ago #

    I've created custom search terms to filter a user choice of selecting wether an event should be hidden or not.

    [events_list hidden="yes"] produces a list of the events that are checked as hidden. when hidden="no" it only shows events checked as not hidden. this is fine.

    [events_calendar hidden="yes"] or hidden="no" both give a calendar with all events displayed, seemingly ignoring my search filter.

    I created my code by following the "creating a custom add-on" tutorial and I read that you should be able to use new search attribute in any of the event, calendar or location shortcodes. Is there something else I'm missing, something I need to add to support the use of this filter on calendars?

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

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    should work if it works for events list (calendar uses EM_Events::get()). If not, I'd advise you check what $args are passed during the functions and figure out where it's been taken off.

  3. Jpyper
    Member
    Posted 2 years ago #

    In my functions passed into em_events_get_default_search and em_events_get I changed them form the tutorial to check for is_string instead of is_array because my values will only be on of two things. Would this cause the events_calendar shortcode not to accept the values being passed?

  4. Topher
    Member
    Posted 2 years ago #

    Hey Marcus, I'm working on this same project with Jarrod. It looks like

    [events_list hidden="yes"]

    works and

    [events_calendar hidden="yes"]

    does not. That indicates to me that the logic in the functions is working, we just need to figure out how to make events_calendar see the 'hidden' variable. When we print the args in the function we see it when calling events_list and not when calling events_calendar.

    Do we need to run the filter on a second function or something? Maybe at a different time?

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    in theory it should just work. don't remember if I tested the em_calendar, i will try it out with the tutorial i made, see if that works and get back here

  6. Topher
    Member
    Posted 2 years ago #

    Any luck?

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    just checked this, i can get it to work by adding

    add_filter('em_calendar_get_default_search','my_em_styles_get_default_search',1,2);

    as well as the em_event_get_.. filter

  8. Jpyper
    Member
    Posted 2 years ago #

    That solution is almost obvious now that you showed me.

    Thank you so much, it works great!

    Also, I recently made a calendar with EM that I think turned out really nice, using jQuery to show (on hover of date) a hidden, formatted list of events from a "full" calendar but styled (and using a customized calendar template) to look more like the small one and fit in a widget. I don't know if you have any sort of showcase for EM but I think it would help users visualize what's possibile. I'd be happy to do a write up on how I did it too. The site with the calendar is not live just yet but if you're interested in this let me know. I'm probably going to do a write up about it regardless for my local WP group.

    Thanks again! I really love Events Manager!
    -Jarrod

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    sounds interesting, we will have a showcase section too (along with a demo), so could go on there. if you send a link via our site contact form that'd be nice

  10. redsuit
    Member
    Posted 2 years ago #

    Love the plugin - just have one query:

    When I run a search that doesn't match any of the events it just returns nothing (as you'd expect) but I was wondering how I can get it to display a message like "no events found for this area" or something.

    I have edited the events-search.php but even when I revert back to the original I get the same thing. I noticed in events-search.php there is a comment that says:

    //in order for this to work, you need the above classes to be present in your theme

    What class is that referring to? Is it the em-events-search-form class? Sorry if these questions are lame but I'm just trying to get my head around it.

    Any input much appreciated - thanks

  11. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    you'd want to edit the events-list.php template file. There's an if clause that deals with no events.

  12. redsuit
    Member
    Posted 2 years ago #

    Cheers Marcus - thanks for all the support and the awesome plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic