WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
The NEXT three events in the widget (12 posts)

  1. jrgreenfield1
    Member
    Posted 2 years ago #

    Hi -
    I've both written a script and tried using a widget to show the next three events but it's still showing 3 random events.

    Any ideas?

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Hey jrgreenfield1. Any chance using template tags could help you out? We've detailed those in some depth at our Documentation page: http://tri.be/support/documentation/.

    Let me know if that's not as specific as what you're looking for, and we'll do what we can to assist. Thanks!

  3. jrgreenfield1
    Member
    Posted 2 years ago #

    Hi Rob, It's not I don't think. I'm using the following code currently which uses the template tag tribe_get_events, but for some reason the 'upcoming' aren't displaying the next three. I tried displaying using the widget and that displays the same 'non next 3' events. Any suggestions?

    <?php global $post;
    $upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'posts_per_page'=>3) );
    foreach($upcoming as $post) : setup_postdata($post);
    
    echo '<h3 class="clearfix"><a href="';
    the_permalink();
    echo '">';
    the_title();
    echo '</a></h3>';
    
    if ( has_post_thumbnail() ) {
          echo '<a href="';
          the_permalink();
          echo '"><div style="float:left;margin:0 10px 10px 0;" >';
          the_post_thumbnail('thumbnail');
          echo '</div></a>';
          the_excerpt();
         } else {
          echo the_excerpt();
          }
    
    endforeach; ?>
  4. Trevor Gehman
    Member
    Posted 2 years ago #

    I'm having a similar issue, except I'm trying to just get the next ONE event, rather than three. It doesn't seem to be pulling events in the right order...

  5. Trevor Gehman
    Member
    Posted 2 years ago #

    Hmm... I had a similar issue, but here's the code that worked for me finally:

    global $post;
        $events = tribe_get_events(array(
                'eventDisplay'=>'upcoming',
                'posts_per_page'=>1
        ));      
    
        foreach($events as $post) { setup_postdata($post);
        echo '<a href="/events/">'.get_the_title().'<span>'.tribe_get_start_date($post->ID, false, 'M j').'</span></a>';
        }
        wp_reset_query();
  6. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Thanks for confirming, Trevor.

    JRGreenfield: Any chance Trevor's code got you where you need to be, or at least pointed you in the right direction? Let me know if not and I can get someone on our team looking into this.

  7. jrgreenfield1
    Member
    Posted 2 years ago #

    Hi Rob and Trevor -
    Sorry it's taken so long for me to get back-- Had a baby boy on Tuesday.

    No dice on that code. I just can't figure this one out! I'm wondering if it has to do with the upgrade and import of old calendar items.

    BTW - Rob, thanks for being so on top of support. Your involvement and responsiveness is appreciated.

  8. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Congrats on the baby, JRgreenfield! That's exciting. Thanks for the words, too :)

    As for this issue: since it's continuing to present itself as a problem, I'm going to get a dev on our end to respond here. I've passed this on to the team so hopefully we can get a response here over the next couple days. Apologies for the inconvenience in the interim.

  9. jrgreenfield1
    Member
    Posted 2 years ago #

    Hi Rob-
    Thanks! I think my "wringer developer" (plug for him - Mike at cfxdesign.com) solved it and he thought that it was an error in the plugin itself. He mentioned that he submitted it to you guys so keep an eye out for it. Thanks again!

  10. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Oh, awesome to hear. Thanks for confirming - did Mike say whether he'd emailed that or posted on the forum? Want to make sure we don't lose it.

  11. Johnwromine
    Member
    Posted 2 years ago #

    You can try this, it worked for me!

    <?php $loop = new WP_Query( array( 'post_type' => 'tribe_events', 'posts_per_page' => 2 ) ); ?>
    					<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    					<?php get_post_meta($post->ID, 'events', true); ?>
    					<?php endwhile; ?>
    						<!----Upcoming Events---->
    						<?php global $post;
    						$upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'posts_per_page'=>2  ) );
    						foreach($upcoming as $post) : setup_postdata($post);
    							//post title
    							echo '<div class=" event-post-thumb"><h4><a href="';
    							the_permalink();
    							echo '">';
    							the_title();
    							echo '</h4>';
    
    							//post date
    							echo '<p>';
    							echo tribe_get_start_date( $post->ID, false, 'D. M j, Y' );
    							echo '</p>';
    
    							//post thumbnail and excerpt
    							if ( has_post_thumbnail() ) {
    								  echo '<a href="';the_permalink();echo '">
    								  <div class="" >';the_post_thumbnail('small-list-thumbnail');echo '</div></a>';
    								  echo '<div class="fr">';
    								  the_excerpt();} else {echo the_excerpt();
    								  echo '</div>';
    								  }
    						endforeach;
    						?>
  12. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Awesome! Thanks for sharing. Would certainly be interested to hear if this solution did the trick for any other users who'd posted about this as well. Either of you guys able to give this a go?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic