• Resolved lucycgp

    (@lucycgp)


    Hello all,

    I am trying to find an answer to this but I can’t! The Events Calendar is really really good, and has helped me no end, but one thing is bugging me. How do you make events appear chronologically, so the soonest event at the top? At the moment the events list is showing in the order I posted them which looks all wrong.

    Sorry if I am repeating a question, but I cannot find the answer and have been trying to find it for a couple of hours.

    Thank you to anyone that may be able to help!

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

Viewing 15 replies - 16 through 30 (of 50 total)
  • I am having the same issue. Events are showing in posted order not date order. Upgraded to 2.02 Pro but have the same issue.

    A quick check of the code (I am no coder so excuse if I have this wrong) in the-events-calendar/views/list.php and the loop appears not to specify any order – it just looks for posts and takes them in order!

    <?php if (have_posts()) : ?>
    <?php $hasPosts = true; $first = true; ?>
    <?php while ( have_posts() ) : the_post(); ?>

    Simon

    Hey Simon. I see you mention that you upgraded to 2.0.2; have you had a chance to jump to 2.0.3 (for both free + PRO) yet? That do anything for you?

    OK, i temporary solve.
    Modified file …lib\the-events-calendar.class.php

    Added rows from 1910 to 1924, on function getEvents, this is the new code of the function:

    public function getEvents( $args = ” ) {
    $tribe_ecp = TribeEvents::instance();
    $defaults = array(
    ‘posts_per_page’ => get_option( ‘posts_per_page’, 10 ),
    ‘post_type’ => TribeEvents::POSTTYPE,
    ‘orderby’ => ‘event_date’,
    ‘order’ => ‘ASC’
    );
    /*——— Funzione modificata by Faber ——–*/
    $upcoming = array(
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘_EventStartDate’,
    ‘order’ => ‘ASC’,
    ‘meta_key’ => ‘_EventStartDate’,
    ‘meta_value’ => date(“Y-m-d”),
    ‘meta_compare’ => ‘>=’,
    );

    if (strpos(strval($args), ‘upcoming’) > 0) {
    $args = str_replace(‘upcoming’,”,$args);
    $args = wp_parse_args( $args, $upcoming);
    }
    /*——— Fine Funzione modificata by Faber ——–*/
    $args = wp_parse_args( $args, $defaults);
    return TribeEventsQuery::getEvents($args);
    }

    I waiting real definitive bug solution.

    Thanks

    @faberk, sorry for me it will not work ;-(.
    LINK

    Hey uwest. If you want me to send you the current code (a bit further than 2.0.3 but not yet stable 2.1), it may fix your issue…worth a shot anyway. Let me know if you’re interested; rob at tri.be. Thanks!

    Hey uwest. My code writed to work correctly only in the widget.

    Hey faberk, now i recognize it. For me too! 😉

    To temporary solve all problem on all pages, yuo can modify only the file: the-events-calendar\lib\tribe-event-query.class.php.
    You need to comment the if section on function dateOrderBy in this mode:

    public static function dateOrderBy($order_sql, $cur_query) {
    			//if( $cur_query->get( 'orderby' ) == 'event_date' ) {
    				$direction = $cur_query->get( 'order' );
    				$order_sql = "DATE(eventStart.meta_value) $direction, TIME(eventStart.meta_value) $direction";
    			//}
    			return $order_sql;
    		}

    [Please post code or markup snippets between backticks or use the code button.]

    So all visualization are in event start order (ASC mode)

    For developers: seems, on $cur_query variable, not content the orderby fild, so bypass the if section.

    Sorry for my bad english, i hope you understand all.

    Bye

    Hi faberk, it works!!! Many Thanks for that, a really big help.

    Thanks a lot for sharing that, faberk. I’m going to have our devs double check against this to see what we were doing wrong – and if it was indeed something that needs changing, we’ll add into the 2.1 code.

    Thanks roblagatta. My simple solution is only for temporary and emergency use.
    I don’t know the real solution, i think it neededd deep code knowledge.
    We waiting for definite resolution.

    Best regards

    Hey guys. We took another look at this solution, and here’s a solution that could apply more long-term if someone were willing to test and verify whether it works for them (as we’ve been unable to recreate this problem locally nobody on our team is in a position to do so).

    It looks like the function you edit dateOrderBy is applied to a filter ‘posts_orderby’, which is applied to the ORDER BY part of the SQL query when getting posts. My good guess as to why it is not working properly for you all is that another function from another plugin (or the theme) is being applied to the filter *before* ours is (mind you, ours only makes a change if the current value is orderby => event_date, which if it has already been filtered, it no longer will be). This means that if another plugin or the theme is ordering and has a higher priority hooking into the filter, it would explain the problem perfectly (and why we are unable to recreate it). One solution is upping the priority of our filter and seeing if that fixes it. In line 35 of tribe-event-query.class, change:

    add_filter( 'posts_orderby', array(__CLASS__, 'dateOrderBy'), 10, 2);

    to

    add_filter( 'posts_orderby', array(__CLASS__, 'dateOrderBy'), 1, 2);

    That ought to do the trick, but please let us know after testing whether or not it actually does. If so we’ll include this in the 2.1 code. Thanks!

    Hi roblagatta,
    I have the same problem. I try all the solution above with no luck.

    Please have a peek on these links:
    Case 1
    I’m having Descending order.

    Case 2
    The order is messy..

    Please help!!

    For a temporary fix. I’m thinking to change the default link for category event list view.

    e.g
    http://www.domain.com/?tribe_events_cat=slug
    into
    http://www.domain.com/?post_type=tribe_events&tribe_events_cat=slug&eventDisplay=upcoming

    The question is How can I change that?
    In my case the upcoming category event list have no order problem.

    Btw, I’m not using pretty permalinks.. so this solution might work for me.

    Thanks.

Viewing 15 replies - 16 through 30 (of 50 total)
  • The topic ‘[Plugin: The Events Calendar] Events list in chronological order’ is closed to new replies.