Support » Plugin: The Events Calendar » Custom Date range.

  • My client insist that each event be posted by month, However I don’t think I understand how the custom date range works. As this is supposed to pull event only for January, yet I get feb dates.

    <?php
    
    global $post;
    $current_date = date('1-01-2013');
    $end_date = date('1-31-2013');
    
    $get_posts = tribe_get_events(array('start_date'=>$current_date,'end_date'=>$end_date,'posts_per_page'=>10) );
    
    foreach($get_posts as $post) { setup_postdata($post); ?>
    <div class="rg-events-loop">
    <div class="rg-events-date"><?php echo tribe_get_start_date($post->ID, false, 'F j, Y'); ?></div>
    <div class="rg-events-title"><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
    </div>
    <div class="rg-events-meta-list">
    		<ul>
    	        <?php if( tribe_address_exists( get_the_ID() ) ) {echo '<li>' . tribe_get_full_address( get_the_ID() ) .'</li>';} ?>
    			<?php if($cfs->get('host')){echo '<li>' . $cfs->get('host') . '</li>';}?>
    			<?php if($cfs->get('event_url')){echo '<li><a href="' . $cfs->get('event_url') .'">'. $cfs->get('event_url') .'</a></li>';}?>
    	   </ul>
    	  </div>
    <?php } //endforeach ?>
    <?php wp_reset_query(); ?>

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

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter rgfxnet

    (@rgfxnet)

    Anybody? It should be easy to point me in the right direction. Thanks

    Rob La Gatta

    (@roblagatta)

    Hey rgfxnet. Thanks for the note here; totally, we should be able to point you in the right direction on this end. Let me get Jonah from the team to take a look here and respond directly – expect a response on that end over the next 24 hours. Thanks for your patience so far.

    jonahcoyote

    (@jonahcoyote)

    Hey rgfxnet,

    I think the problem is the dates you’re providing are not in the right format. Try using this format instead:

    $current_date = date('Y-m-d H:i:s', strtotime('now'));
    $end_date = date('Y-m-d H:i:s', strtotime('+5 months'));

    I hope that helps!

    – Jonah

    Thread Starter rgfxnet

    (@rgfxnet)

    I need a specific date range. Not for now till the next 5 months. The client wants me to have list as so.

    Jan

    event 1
    event 2

    Feb

    event 1
    event 2

    March

    and so on.

    Thanks for the response, hope to hear from you soon .

    jonahcoyote

    (@jonahcoyote)

    Hey rgfxnet,

    If you only need one month just change ‘+5 months’ to ‘+1 month’.

    Cheers,
    Jonah

    Thread Starter rgfxnet

    (@rgfxnet)

    Right, but doesn’t that start from now, not a specific date that I can assign?

    jonahcoyote

    (@jonahcoyote)

    $current_date starts from now. Yes, you can also specify a hard coded range, it just needs to be in that ‘Y-m-d H:i:s’ format.

    – Jonah

    Thread Starter rgfxnet

    (@rgfxnet)

    Which be as so correct? 01/22/2012 12:00:00

    Thanks.

    jonahcoyote

    (@jonahcoyote)

    Nope, it would be like: ‘2012-01-22 12:00:00’

    Thread Starter rgfxnet

    (@rgfxnet)

    still seem to be getting issues, but closer. Here is my code, I tried many combinations.

    <h1>Jan</h1>
    <?php
    
    global $post;
    $current_date = date('2013-01-01 00:00:01');
    $end_date = date(strtotime('2013-01-31 23:59:59'));
    $get_posts = tribe_get_events(array('start_date'=>$current_date,'end_date'=>$end_date,'posts_per_page'=>10) );
    
    foreach($get_posts as $post) { setup_postdata($post); ?>
    <div class="rg-events-loop">
    <div class="rg-events-date"><?php echo tribe_get_start_date($post->ID, false, 'F j, Y'); ?></div>
    <div class="rg-events-title"><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
    </div>
    <div class="rg-events-meta-list">
    		<ul class="meta-list">
    	        <?php if( tribe_address_exists( get_the_ID() ) ) {echo '<li>' . tribe_get_full_address( get_the_ID() ) .'</li>';} ?>
    			<?php if($cfs->get('host')){echo '<li>' . $cfs->get('host') . '</li>';}?>
    			<?php if($cfs->get('event_url')){echo '<li><a href="javascript:void()" onclick="window.open(\'' . $cfs->get('event_url') .'\',\'mywindow\',\'height=600, width=800,location=no,scrollbars=yes,left=\' + (screen.width - 800) / 2 + \',top=\' + (screen.height - 600) /2);">Event Url</a></li>';}?>
    	   </ul>
    	  </div>
    <?php } //endforeach ?>
    <?php wp_reset_query(); ?>
    jonahcoyote

    (@jonahcoyote)

    Hey rgfxnet,

    Sorry for the delay in getting back to you. I’m not sure why this is not working correctly so I’m having a developer take a look. Stay tuned.

    – Jonah

    Thread Starter rgfxnet

    (@rgfxnet)

    Jonah,

    Any word from the developer?

    Thanks

    jonahcoyote

    (@jonahcoyote)

    Hi rgfxnet,

    Unfortunately not yet, but I’m going to check in with the developer again and see where this is at. Stay tuned.

    Thanks,
    Jonah

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Custom Date range.’ is closed to new replies.