Forum: Global Maps

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support related to the Global Maps premium extension please open a new premium support ticket.

[Not a support question]Events Calendar posts – hide past events

Forums Global Maps Events Calendar posts – hide past events

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #50229

    Hi, I’m using the Global Maps tool to display The Events Calendar Events custom post type but I only want to have events come up in the map that haven’t taken place yet. Is there a function I can use to hide past events from showing up without having to hack the plugin? Thanks.

    #50378
    Chris Homan
    Member

    I’d be very interested in hearing about this as well. Any progress on this?

    #50379

    Hi,
    The Global Maps add-on uses the WP_Query class to query the results. You need to filter the WP_Query based on the date, which I believe is saved in custom fields, and show only events that equal or later than todays date.

    The filter you can use is:

    and can be found in omw-global-maps/posts/includes/gmaps-query-functions.php.

    You can check the codex for information regarding WP_Query.

    Also, this article has few examples regarding WP_Query and at the button of the page there is the “Real World Example” which filter post types events based on the date.

    I hope that helps.

    #50380

    There is one thing you will need to do if you are going to filter the WP_Query.

    In the file:
    gmw-global-maps/posts/includes/gmaps-query-functions.php

    You need to remove line 499 which should be:

    This work around can only be done by editing the code file but in a future update I will fix that.

    #50396

    Thanks for getting back to me. So if I add the below code to my themes functions file, would that work:

    add_filter( 'eventDisplay', array( $this, 'upcoming' ) );

    #50411

    Hi Adam,
    The above will not work.

    You need to create a custom function that filters the WP_Query based on your needs. It required some PHP and WordPress filters knowledge.

    Below is an example of how to create a custom function and execute it using the filter. But you will need to modify the query arguments based on your needs within that function. Thats where you could look in the links I mentioned above for some ideas of how to do that.

    #50420

    Hi,

    I’m not very familiar with filters – what I’m trying to do is add the following wp_query property to the array in the gmaps-query-functions.php file:

    'eventDisplay' => upcoming

    Could you possibly give an example of how the above can be added with your filter in my theme functions file?

    Thanks.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Events Calendar posts – hide past events’ is closed to new replies.