Here’s the documentation on the search attributes for the events list: https://wp-events-plugin.com/documentation/event-search-attributes/
[events_list pagination=1 scope="2024-01-01,2024-06-23"]
Thank your for your answer! And sorry for my terrible explanation of what I am trying to accomplish. Maybe this makes it clearer… I look for the outcome one would expect from
[events_list pagination=1 scope="2024-01-01,today"]
Which unfortunately doesn’t work… at least not when I tried.
Thank you!
Add the following code snippet to create your own shortcode to do that:
add_shortcode('my_events_list', function( ) {
$year = date("Y");
$begin_of_year = new DateTime("$year-01-01");
$start = $begin_of_year->format('Y-m-d');
$today = new DateTime('now');
$today->setTime(23, 59, 59);
$end = $today->format('Y-m-d');
return do_shortcode('[events_list pagination=1 scope="' . $start . ',' . $end . '"]');
} );
You can use the Code Snippets plugin to add this code snippet.
On your page you would use the [my_events_list] shortcode.
Remove the following line if you don’t want today’s events to be included in the results:
$today->setTime(23, 59, 59);
-
This reply was modified 9 months, 2 weeks ago by joneiseman.
Thank you so much!
Unfortunately I must be missing the knowledge to set this up properly. Somehow the shortcode works but it doesn’t return the expected list of events, it just shows “[events_list pagination=1 scope=”2024-01-01,2024-02-29″]”. I am very sorry to steal your time but would you be able to help me find out what I am doing wrong? I’ve tried for hours now… but I am just too stupid!
https://interpenetration.net/archive-2024/
Thanks!
-
This reply was modified 9 months, 1 week ago by saotome.
I’m sorry but I’m not able to help you with getting that to work.
If you have successfully added and activated the code snippet then the shortcode you should add is [my_events_list] (not [events_list pagination=1 scope=”2024-01-01,2024-02-29″]).
That’s what I did. I added [my_events_list]. The page then does not show the list of events but “[events_list pagination=1 scope=”2024-01-01,2024-02-29″]”. Which means that somehow it works because it actually shows today’s date.
But if you’re not able to help I won’t bother you any longer. Thank you for your help up to this point. It is VERY appreciated!
with regards to the pagination, I escalated this to the Devs. should get fixed soon
I finally had time to look into this again and found out that for whatever reason one of the brackets in the shortcode had transformed into its html number. Since I did nothing but copy-pasting it I never checked the code itself…
Now everything works. Thank you again!
In case joneiseman or someone with the knowledge sees this… How can I change the order of the events? I want the most recent event first… (and i am talking about changing it when using joneiseman’s shortcode!)
Thank you!
-
This reply was modified 9 months, 1 week ago by saotome.
Add order=”desc” to the shortcode. Change this line in the code snippet:
return do_shortcode('[events_list pagination=1 scope="' . $start . ',' . $end . '"]');
To this:
return do_shortcode('[events_list pagination=1 order="desc" scope="' . $start . ',' . $end . '"]');
-
This reply was modified 9 months, 1 week ago by joneiseman.
OH! Thank you for the SUPER quick answer!
So the order is important, I see. I had “order=”desc”” but had put it at the end of that line.. which didn’t work.
Thank you so much!
The order doesn’t matter. It must have been something else that prevented it from working.
Ok, thanks for letting us know!
It’s working now!
Thank you again!
-
This reply was modified 9 months, 1 week ago by saotome.