Version three breaks custom event display using (WP_Query)

Home Forums Calendar Products Events Calendar PRO Version three breaks custom event display using (WP_Query)

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #53458
    mindshare
    Participant

    Any thoughts on why this code no longer returns the correct set of events in the new version?


    $month = new WP_Query(
    array(
    'post_type' => 'tribe_events',
    'start_date' => date('j M Y', strtotime('first day of this month')),
    'end_date' => date('j M Y', strtotime('last day of this month')),
    'eventDisplay' => 'all',
    'posts_per_page' => -1
    )
    );

    I have a custom events widget I wrote which worked fine before the latest upgrade.

    #53467
    Jonah
    Participant

    Hi mindshare,

    I’m not sure, what is happening with the above query?

    – Jonah

    #53472
    mindshare
    Participant

    Well have been using it to display “this months” events (along with two other custom queries in the widget for “this week” and “next month”).

    Now with the latest plugin update the queries seem to be returning all events, without respect to the start/end parameters.

    #53474
    mindshare
    Participant

    Here’s complete code in case that helps:

    <?php
    /**
    * widget-events.php
    *
    * @created 4/29/13 11:53 PM
    * @author Mindshare Studios, Inc.
    * @copyright Copyright (c) 2013
    * @link http://www.mindsharelabs.com/documentation/
    *
    */

    if(date('l') == 'Monday') {
    $start_date_week = date('j M Y', strtotime('today'));
    } else {
    $start_date_week = date('j M Y', strtotime('last Monday'));
    }
    $end_date_week = date('j M Y', strtotime('this Sunday'));

    $start_date_month = date('j M Y', strtotime('first day of this month'));
    $end_date_month = date('j M Y', strtotime('last day of this month'));

    $start_date_next = date('j M Y', strtotime('first day of next month'));
    $end_date_next = date('j M Y', strtotime('last day of next month'));

    //echo ''; var_dump($end_date_next); echo ''; die;

    ?>

    Events & Information

    This Week
    This Month
    Next Month

    'tribe_events',
    //'eventDisplay' => 'past',
    'start_date' => $start_date_week,
    'end_date' => $end_date_week,
    'eventDisplay' => 'all',
    'posts_per_page' => -1
    )
    );
    ?>
    have_posts()) : ?>
    have_posts()) : $week->the_post(); ?>
    <li class="post-">

    <a href="">
    <a href="">
    ...

    No events found.

    'tribe_events',
    //'eventDisplay' => 'past',
    'start_date' => $start_date_month,
    'end_date' => $end_date_month,
    'eventDisplay' => 'all',
    'posts_per_page' => -1
    )
    );
    ?>
    have_posts()) : ?>
    have_posts()) : $month->the_post(); ?>
    <li id="post-">

    <a href="">
    <a href="">
    ...

    No events found.

    'tribe_events',
    //'eventDisplay' => 'past',
    'start_date' => $start_date_next,
    'end_date' => $end_date_next,
    'eventDisplay' => 'all',
    'posts_per_page' => -1
    )
    );
    ?>
    have_posts()) : ?>
    have_posts()) : $next->the_post(); ?>
    <li id="post-">

    <a href="">
    <a href="">
    ...

    No events found.

    All Events

    #53506
    Jonah
    Participant

    Hi mindshare,

    Can you please post the code to http://snippi.com/

    Thanks,
    Jonah

    #53509
    mindshare
    Participant

    Yep here you go: http://snippi.com/s/p6ksd5t

    #54025
    mindshare
    Participant

    Hi Jonah. Any updates on this?

    #54168
    Jonah
    Participant

    Hi mindshare,

    Ok, two things. One, you need to use ‘eventDisplay’ => ‘custom’ on any custom query now or else our plugin will hijack yours. Two, your date/time format for the query needs to be in ‘Y-m-d H:i:s’ format. Try those modifications and let me know how that goes.

    Regards,
    Jonah

    #54208
    mindshare
    Participant

    That rocks! I totally worked. Thanks so much for the help.

    #54216
    Jonah
    Participant

    You’re welcome mindshare, glad to hear it! Let us know if you need help with anything else.

    – Jonah

    #979872
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Version three breaks custom event display using (WP_Query)’ is closed to new replies.