Viewing 7 replies - 1 through 7 (of 7 total)
  • Why don’t you try this:
    <?php echo tribe_get_start_date($post->ID, false, ‘M j,Y’); ?>

    Let me know if it doesn’t work?

    Thread Starter coexsystem

    (@coexsystem)

    Yes that is the line of code I have been trying to use.

    <?php
    $args=array(
    'post_type' => 'tribe_events',
    'meta_key' => 'wpcf-featured',
    'meta_value' => '1',
    'posts_per_page' => 3
    
    );
    //EventStartDate
    //EventEndDate
    query_posts($args);
    
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    <?php
    //print_r($post);
    
    $sd = tribe_get_start_date($post->ID, false, 'M j, Y');
    $ed = tribe_get_end_date($post->ID, false, 'M j, Y');
    if($ed == $ed){
    // single day event
    $timestamp = strtotime($ed);
    $date = date('F j, Y', $timestamp);
    								  }
    <?php $feat_excerpt = get_post_meta($post->ID, 'wpcf-featured-excerpt', true); ?>
    <div class="swiper-slide">
    <div class="img-container">
    <img class="bg-image" src="<?php print wp_get_attachment_url( get_post_thumbnail_id($id) ); ?>" />
    </div>
    <div class="text-box">
    <div class="date"><?php echo $sd; echo " - ".$ed; ?></div>
    <?php the_title(); ?>
    <p><?php print $feat_excerpt; ?></p>
    <br><a class="readmore" href="<?php the_permalink(); ?>">Read ></a>
    						      		</div>
    </div>
    <?php
    endwhile;
    ?>

    Thread Starter coexsystem

    (@coexsystem)

    The problem is in the EVENTS section mid page on this site: http://ddp.constructorinteractive.com/
    I have also tried to use ‘<?php echo tribe_events_event_schedule_details() ?>’
    but it is still returning the event start date as today’s date

    I would like to suggest you don’t use wp_query . here is the simple snippet that I have made by my own.
    <?php
    global $post;
    $all_events = tribe_get_events(array(
    ‘eventDisplay’=>’all’,
    ‘posts_per_page’=>1,
    ‘tax_query’=> array(
    array(
    ‘taxonomy’ => ‘tribe_events_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => ‘call-for-scores’
    )
    )
    ));

    foreach($all_events as $post) {
    setup_postdata($post);
    $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘full’ );
    $url = $thumb[‘0’];

    ?>
    <div class=”bigBox2″>
    <img src=”<?php echo $url;?>”>
    <div class=”bigDate”>

    <span class=”Date”><?php echo tribe_get_start_date($post->ID, false, ‘j’); ?></span>
    <span class=”Date2″><?php echo tribe_get_start_date($post->ID, false, ‘M Y’); ?></span>
    </div>

    </div>

    <?php } wp_reset_query(); ?>

    Let me know if it works for you?

    Thread Starter coexsystem

    (@coexsystem)

    Hi, thanks this worked and really helped me troubleshoot the problem. I think it was in the syntax of the meta_query:

    'meta_query' => array(
    array(
    'key' => 'wpcf-featured',
    'value' => 2
    )
    )

    Got everything working now. Thanks for your help.
    John

    Plugin Contributor leahkoerper

    (@leahkoerper)

    Thanks for helping out sudhanshudubey!

    @coexsystem, I’m glad you got things working 🙂

    Leanne

    (@leanneheller)

    This has been resolved, but I ran into the same issue today and wanted to share the solution in case anyone else needed it. I had to break out the meta query and the events tax query for it to recognize both – otherwise I’d lose filtering by either the meta information (in my case, a pods relationship field) or the tribe events information (the date was showing up as the current date instead of the start date):

    $postid = get_the_ID();
    $args = array(
    'post_type' => 'tribe_events',
    'post_status' => 'publish',
    'posts_per_page' => 5,
    'orderby' => 'date',
    'order' => 'asc', 'paged',
    'eventDisplay'=>'upcoming',
    'tax_query' => array(
    array(
    'taxonomy' => 'tribe_events_cat',
     'field' => 'slug',
     'terms' => array(
    'slug-one', 'slug-two'
    ),
    )
     ),
    'meta_query' => array(
    array(
    'key' => 'pods_relationship_field',
    'value' => $postid, // this was just to get the current page id to use as the meta_value
    'compare' => '=',
    )
    )
    );
    $the_query = new WP_Query( $args );
Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘tribe_get_start_date() providing incorrect data’ is closed to new replies.