Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created September 9, 2012 23:04
Show Gist options
  • Select an option

  • Save jo-snips/3687846 to your computer and use it in GitHub Desktop.

Select an option

Save jo-snips/3687846 to your computer and use it in GitHub Desktop.

Revisions

  1. jo-snips created this gist Sep 9, 2012.
    44 changes: 44 additions & 0 deletions custom-one-month.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    <?php

    global $post;
    $current_date = date('j M Y');
    $end_date = date('j M Y', strtotime('1 month'));
    echo 'Start Date:'. $current_date;
    echo 'End Date:'. $end_date;

    $all_events = tribe_get_events(
    array(
    'start_date' => $current_date,
    'end_date'=> $end_date,
    'posts_per_page' => 5
    )
    );

    foreach($all_events as $post) {
    setup_postdata($post);
    ?>

    <h3 class="entry-title"><a href="<?= tribe_get_event_link($post) ?>"><?php the_title(); ?></a></h3>
    <div style="margin-bottom: 1em">
    <span class="event-date"><a href="<?= tribe_get_event_link($post) ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span>

    <?php if ( has_post_thumbnail() ) { ?>

    <div class="event-thumb">
    <a href="<?= tribe_get_event_link($post) ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
    </div>
    <div class="event-excerpt">
    <?php the_excerpt(); ?>
    </div>

    <?php } else { ?>

    <div class="event-content">
    <?php the_content(); ?>
    </div>

    <?php } ?>
    </div>

    <?php } ?>
    <?php wp_reset_query(); ?>