The Events Calendar Template display bug
-
Having something very odd here, was wondering if someone could inform me why the function below grabs all previous months events up to the end date? ( say you grab events the month of march it will grab all the events for jan and feb. I have added this to my function.php and have been simply calling it from there with
<?php get_month_events(date('Y M'));?>
The bases for this function belongs to the second example From Modern Tribes Documentation
function get_month_events($month){ if(isset($GLOBALS['post'])){unset($GLOBAL['post']);} global $post; // DECLARE GLOBAL $currnt_date = '1 '. $month; $end_date = date('j M Y', strtotime("+1month", strtotime($current_date))); // debug line echo "<p>the month passed was " . $month . "</p><p> start date was " . $current_date . "</p><p>and end date was ". $end_date . "</p>"; $get_posts = tribe_get_events(array('start_date'=>$start_date,'end_date'=>$end_date,'posts_per_page'=>3) ); foreach($get_posts as $post) { setup_postdata($post); /** * HTML TEMPLATE BEGINS! */ ?> <li class="cal-post"> <span class="event-date"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span> <h5 class="event-title"><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h5> <p class="event-content"><?php the_content(); ?></p> </li> <?php /** * HTML TEMPLATE ENDS */ } //endforeach wp_reset_query(); }//endfunction
Thanks in advance for any replies and advice!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘The Events Calendar Template display bug’ is closed to new replies.