-
AuthorPosts
-
October 11, 2020 at 7:17 am #1251999
Hi, I’m having to use the Blog Posts element to display events (because I need to query a custom taxonomy). You just helped me get the event times to show ( https://kriesi.at/support/topic/show-event-time-in-blog-meta/#post-1251670 ), which is amazing. and I’m now I’m wondering if there’s any way to only display upcoming events . Any chance you could help me with that one? Thanks so much!
October 14, 2020 at 3:11 pm #1252787Hey sky19er,
Thank you for the inquiry.
The snippet that the user provided in the following thread should alter the default query of the Post Slider so that it displays the upcoming events. We could adjust it a bit so that it works with the Blog Posts element.
// https://kriesi.at/support/topic/entry-slider-event-calender/#post-995764
Replace avia_post_slide_query with avia_blog_post_query.
Best regards,
IsmaelOctober 14, 2020 at 3:13 pm #1252789Hey sky19er,
Thank you for the inquiry.
The snippet that the user provided in the following thread should alter the default query of the Post Slider so that it displays the upcoming events. We could adjust it a bit so that it works with the Blog Posts element.
// https://kriesi.at/support/topic/entry-slider-event-calender/#post-995764
Replace avia_post_slide_query with avia_blog_post_query.
Best regards,
IsmaelOctober 15, 2020 at 2:50 am #1252882Thanks again, Ismael. It looked to me like maybe you meant for me to only use the bigger snippet in step 2 of that post, right? Or were you thinking I also need to do steps 1 and 3 (add that smaller snippet, create /shortcodes in my child theme and copy the files from /enfold/config-templatebuilder/avia-shortcodes/blog into that folder)?
I tried just adding the bigger snippet from step 2, and it kind of worked, but it seemed to be pulling in all upcoming events (ie, I seemed to lose my custom taxonomy query — the main reason I’m using the blog element), and the featured images were missing. I tried including steps 1 and 3, but that broke the site.
But then I tried your snippet higher on the page — https://kriesi.at/support/topic/entry-slider-event-calender/#post-992681 — and that actually came really close. The featured images were working, and it didn’t seem to be pulling in as many events, but I still lost the custom taxonomy query. Is there maybe a way to modify your snipped to preserve my custom taxonomy queries in my Blog Posts elements (note, the queries are unique to specific pages on the site — ie, the events on https://gobeyondhomes.org/property/camino-del-mar/ are different than on https://gobeyondhomes.org/property/crescent-arms/).
Again, everything is already working in my events lists — I’m just looking for a way to hide past events.
Thanks again and lmk if you have other questions.
October 19, 2020 at 7:10 am #1253825Hi,
Another user requested this, so we provided another version of the filter in the following thread.
// https://kriesi.at/support/topic/entry-slider-event-calender/#post-995502
This part of the filter includes the taxonomy or category query.
$eventquery = array('paged'=> false, 'eventDisplay' => 'list', 'tax_query'=> array( array( 'taxonomy' => 'tribe_events_cat', 'field' => 'term_id', 'terms' => explode(',', $params['categories']) )
Thank you for your patience.
Best regards,
IsmaelOctober 19, 2020 at 8:19 pm #1254138Wait, isn’t that the same answer you gave me before? Or maybe you’re referring to Victoria’s post as opposed to KingsField’s? Either way, I think I had already tried both and shared with you the results. I just tried again and when I use just what’s in Victoria’s post — and change post_slider to blog_post, as you instructed — the taxonomy query in the Blog Posts element is apparently lost — it looks like I instead get a list of every page, post, event, portfolio item — everything on the site, it looks like.
Maybe you’re saying i have to manually enter the taxonomy query in the filter? If so, as I mentioned in my previous post, I don’t know if that that will work for me because the query needs to be different for every page (the client has all these properties — https://gobeyondhomes.org/property/ — and we’re querying events specific to each property).
Also mentioned in my previous post, testing your snippet higher on the page — https://kriesi.at/support/topic/entry-slider-event-calender/#post-992681 — gives me results that seem closest to what I need. So I tried combining the part of Victoria’s filter you said includes the taxonomy or category query with your snipped from higher on the page, but — depending on how I tweaked it — I either got the same results as using Victoria’s whole filter or your whole filter.
So, any other direction you could give me would be very much appreciated. Again, it seems like tweaking your filter — https://kriesi.at/support/topic/entry-slider-event-calender/#post-992681 — to somehow preserve the taxonomy queries in the Blog Posts elements would be idea… but what do I know ;).
Thanks for sticking with this — lmk if you have any other questions for me.
October 22, 2020 at 3:36 am #1254800Hi,
Thank you for the info.
We might be able to preserve the taxonomy parameters or query by including it in the default getEvents function. Unfortunately, we have not tried this yet, so please let us know if it renders any results or not.
/* * add a upcoming event filter to blog posts */ add_filter('avia_blog_post_query', 'avia_blog_post_query_mod_events', 10, 2); function avia_blog_post_query_mod_events( $query, $params ) { $eventquery = array('paged' => false, 'eventDisplay' => 'list', 'tax_query' => $query['tax_query']); $upcoming = Tribe__Events__Query::getEvents( $eventquery, true); $include = array(); foreach($upcoming->posts as $key => $event) { $include[] = $event->ID; } $query['tax_query'] = array(); $query['post__in'] = $include; return $query; }
Or post the login details (FTP and WP) in the private field so that we could test the site.
Best regards,
IsmaelOctober 22, 2020 at 4:26 am #1254816Looks like you nailed it — thank you so much!!!
October 22, 2020 at 6:48 am #1254852Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘remove past posts from blog element’ is closed to new replies.