Home › Forums › Calendar Products › Events Calendar PRO › Featured event
- This topic has 6 replies, 4 voices, and was last updated 7 years, 6 months ago by Alain.
-
AuthorPosts
-
September 22, 2016 at 10:55 am #1167579AlainParticipant
Is it possible to have featured event section enabled on event list type pages?
I’ve found this post, but I didn’t found the technical information to show vents from a specific category.
https://theeventscalendar.com/support/forums/topic/feature/Thanks!
September 22, 2016 at 1:43 pm #1167640AlainParticipantI tried to set Multiple Loops in Action just like regular post in WordPress :
https://codex.wordpress.org/The_Loop#Multiple_Loops_in_ActionHere’s my code in the loop of the list :
<div class="tribe-events-loop"> <?php $my_query = new WP_Query( 'tribe_event_in_category=feature_event' ); while ( $my_query->have_posts() ) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?> <!-- Event --> <div id="post-<?php the_ID() ?>" class="<?php tribe_events_event_classes() ?>" <?php echo $post_parent; ?>> <?php tribe_get_template_part( 'list/single', 'event' ) ?> </div> <?php endwhile; ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); if ( $post->ID == $do_not_duplicate ) continue; ?> <?php do_action( 'tribe_events_inside_before_loop' ); ?> <!-- Month / Year Headers --> <?php tribe_events_list_the_date_headers(); ?> <!-- Event --> <?php $post_parent = ''; if ( $post->post_parent ) { $post_parent = ' data-parent-post-id="' . absint( $post->post_parent ) . '"'; } ?> <div id="post-<?php the_ID() ?>" class="<?php tribe_events_event_classes() ?>" <?php echo $post_parent; ?>> <?php tribe_get_template_part( 'list/single', 'event' ) ?> </div> <?php do_action( 'tribe_events_inside_after_loop' ); ?> <?php endwhile; endif; ?> </div><!-- .tribe-events-loop -->
- This reply was modified 7 years, 7 months ago by Alain.
September 23, 2016 at 7:04 am #1167886JoshParticipantHey Alain,
Thanks for reaching out to us!
This approach you’re looking into I think could work for the featured events display.
To start, based on your current code above are you running into issues where the custom query you added isn’t returning any events for the featured section? You can start with addressing that part by modifying your approach on the “$my_query”. To create the new WP_Query there, try the following and see where that gets you with:
https://gist.github.com/BeardedGinger/5934925fbe53bd0ede366ef3da1cd419
Let me know if this helps.
Thanks!
September 26, 2016 at 7:41 am #1168715AlainParticipantThanks Josh.
Your query works, but it shows the past events if they have the category and the feature event is duplicated in the list below.
I did put the #do_not_duplicate variable, but it doesn’t work.
https://codex.wordpress.org/The_Loop#Multiple_Loops_in_ActionSeptember 27, 2016 at 6:41 am #1169167JoshParticipantHey Alain,
Instead of using a default WP_Query() there, you could use our “tribe_get_events” function that would contain more to have a natural pull of events there.
If you”re using the $do_not_duplicate variable there, do you have it added to both queries where it is assigned at the top and then excluded below?
Thanks!
October 19, 2016 at 9:35 am #1179128Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Featured event’ is closed to new replies.