• Resolved DCuserName

    (@dcusername)


    Hi, I see on the Events Manager website that hooks and filters are being added. Any chance that there’s a way to change the events query before the results are rendered? I’m looking for a way to show events of only one category for instance, or based on a custom field.

    By the way I’m not using the default pages, but creating custom layouts via the shortcode system.

    Has anyone done this, any suggestions?

    Thanks!
    David

    • This topic was modified 7 years, 6 months ago by DCuserName.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The category filter is built-in. 🙂
    [events_list category=”CATEGORY ID”]

    http://wp-events-plugin.com/documentation/shortcodes/

    If you want to use a custom field, you will need custom coding.

    Thread Starter DCuserName

    (@dcusername)

    Thanks Patrick, I saw that but was hoping to find a hook to be able to change the query pre-display, so that I can make use a single calendar theme template that uses the shortcode, but displays different results based on the custom field from the specific page where the template is used.

    I’ll play with the shortcode though, worst case maybe I generate the shortcode to a custom field on each page, then use that on subsequent page loads — a little hacky but it could maybe work….

    Thanks!
    David

    Thread Starter DCuserName

    (@dcusername)

    For what it’s worth, this seems to work.

    I created a PHP file containing the shortcode stored as a variable, $eventslist_shortcode, with another variable, $cat_ids, for the actual categories — that could be passed in the URL, from a form submission, from a page’s custom field, etc.

    $eventslist_shortcode = '[events_list_grouped mode="monthly" limit="20" category="'.$cat_ids.'"] <-----HTML AND PLACEHOLDER TAGS GO HERE ---> [/events_list_grouped]';

    Then created a function in a new page template like this:

    include_once(get_stylesheet_directory() . '/some/path/eventlist_shortcode.php');
    echo do_shortcode($eventslist_shortcode);

    Can be fancied up a bit, but as proof of concept it does what I need, so yay!

    And it seems to work so far

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Hook to change events query?’ is closed to new replies.