Home › Forums › Calendar Products › Events Calendar PRO › Display Current Day's Events Using a Shortcode
- This topic has 4 replies, 3 voices, and was last updated 8 years, 2 months ago by Support Droid.
-
AuthorPosts
-
January 26, 2016 at 3:07 am #1062252ChrisParticipant
Hello,
I have a need to display the events of the current day as a list. I see there is a day.php which I assume does the trick, but my coding skills are not as required, and I can not find any code that resembles what I need.
Is there a shortcode that can be filtered using parameters that can show just today’s events?
Thanks,
Chris
January 26, 2016 at 8:22 am #1062559BrianKeymasterHi,
Thanks for using our plugins. I can help out here.
We do not have a feature to show only today’s events, but you could use the Event List Widget and this snippet:
/*
* The Events Calendar - Limit the upcoming widget to just event running today
*/
add_filter( 'tribe_events_list_widget_query_args', 'tribe_modify_list_widget_args', 10, 1 );
function tribe_modify_list_widget_args ( $args ) {
$start_date_init = date ( 'Y-m-d' );
$start_date_end = $start_date_init . ' 23:59:59';
$args['meta_query'][] = array('key' => '_EventStartDate','type' => 'DATETIME','compare' => '>=','value' => $start_date_init);
$args['meta_query'][] = array('key' => '_EventStartDate','type' => 'DATETIME','compare' => '<=','value' => $start_date_end);
return $args;
}Add that coding to your child theme’s functions.php (or parent them) and let me know if that works.
Thanks
January 26, 2016 at 2:42 pm #1062735ChrisParticipantThanks Brian, that code looks great for my needs.
In looking at it, I assume that will change the Upcoming Widget for all instances on the site, and if I only want to change a single page instance of the widget, the function contents need to be wrapped in a conditional statement identifying the page and allowing it to run only if the page identifier is true.
Is that correct?
Thanks again,
Chris
January 27, 2016 at 7:55 am #1063154BrianKeymasterHi,
Yep this would work on all Event List Widgets.
This coding worked to target a specific one:
https://gist.github.com/jesseeproductions/a99528506ec2f42c8e3f
You would want to change this: tribe-events-adv-list-widget-2
To the number of the widget you would like to target.
That can be found in the source code on the front end. I can help with that if you provide a link.
Thanks
February 20, 2016 at 8:35 am #1078900Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Display Current Day's Events Using a Shortcode’ is closed to new replies.