WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
Custom Date range. (14 posts)

  1. rgfxnet
    Member
    Posted 1 year ago #

    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/

  2. rgfxnet
    Member
    Posted 1 year ago #

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

  3. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 1 year ago #

    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.

  4. jonahcoyote
    Member
    Posted 1 year ago #

    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

  5. rgfxnet
    Member
    Posted 1 year ago #

    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 .

  6. jonahcoyote
    Member
    Posted 1 year ago #

    Hey rgfxnet,

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

    Cheers,
    Jonah

  7. rgfxnet
    Member
    Posted 1 year ago #

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

  8. jonahcoyote
    Member
    Posted 1 year ago #

    $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

  9. rgfxnet
    Member
    Posted 1 year ago #

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

    Thanks.

  10. jonahcoyote
    Member
    Posted 1 year ago #

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

  11. rgfxnet
    Member
    Posted 1 year ago #

    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(); ?>
  12. jonahcoyote
    Member
    Posted 1 year ago #

    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

  13. rgfxnet
    Member
    Posted 1 year ago #

    Jonah,

    Any word from the developer?

    Thanks

  14. jonahcoyote
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.