Featured event

Home Forums Calendar Products Events Calendar PRO Featured event

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1167579
    Alain
    Participant

    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!

    #1167640
    Alain
    Participant

    I tried to set Multiple Loops in Action just like regular post in WordPress :
    https://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

    Here’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.
    #1167886
    Josh
    Participant

    Hey 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!

     

    #1168715
    Alain
    Participant

    Thanks 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_Action

    #1169167
    Josh
    Participant

    Hey 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!

    #1179128
    Support Droid
    Keymaster

    Hey 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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Featured event’ is closed to new replies.