Upgrade to 3.3 gets alphabetized events list archive

Home Forums Calendar Products Events Calendar PRO Upgrade to 3.3 gets alphabetized events list archive

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #89319
    Norine Leibel
    Participant

    I just upgraded to V3.3 and my events category archive list are now being alphabetized, rather than displaying chronologically by date. I have a function to alphabetize all other posts, but to this point it has not interfered with TEC Pro. Worth noting is that the events list displayed for Venue and Organizer appear unaffected. Can you help? Thanks.

    #90328
    Kelly
    Participant

    Hi, onelittlemoose. Great question!

    I haven’t heard about that, but it would probably be helpful if we could see your function to get a better idea of what it’s doing. Would you be up for sharing that with us?

    #90550
    Norine Leibel
    Participant

    Thanks, Kelly. Function copied below. The strangest thing is that it all worked fine until I upgraded to 3.3. The function must need some adjustment, which I’m hoping someone can help with:

    // TO ALPHABETIZE THE POSTS
    function mw_change_post_order(){
    if ( is_archive ){
    global $wp_query;
    $args = array_merge( $wp_query->query, array( ‘orderby’ => ‘title’,’order’ => ‘ASC’ ) );
    query_posts( $args );
    }
    }
    add_action(‘genesis_before_loop’,’mw_change_post_order’);

    #91430
    Kelly
    Participant

    Hi, onelittlemoose. Thanks for sending your code. That’s very helpful.

    I am not aware of any change that would affect this in v3.3. However, your plugin does not appear to be calling the is_archive function properly. Perhaps that is the problem? Here is a snippet where it calls it correctly… Without the genesis theme I cannot test to ensure this works, but I think it might.

    http://pastebin.com/cXynh6Jz

    Please let us know how it goes! 🙂

    #92085
    Norine Leibel
    Participant

    Thanks, Kelly. Sadly, no, the new code doesn’t seem to change anything.
    Is there a way to exclude the events category archive from the function?

    #92249
    Brook
    Participant

    Howdy onelittlemoose,

    Kelly and I have been discussing your code snippet. To be honest I am surprised that it worked before. But, if it is working for you then all you should need is an extra conditional.

    We have a bunch of available functions for detecting what type of event page this is. In our documentation we display a list of available functions in the left hand pane. The function tribe_is_event_category() can be used to detect if you are on a event category page or not. If you do not want code to run on those pages, then wrap that code in a conditional that checks with the tribe_is_event_category function.

    I hope that makes sense. Please let us know if you have any questions about our tribe_ functions. We would be very happy to assist you with anything related to our API. Thanks!

    – Brook

    #92578
    Norine Leibel
    Participant

    Thanks for taking the time, Brook.

    I may have solved it. Referencing the WordPress Codex here http://codex.wordpress.org/Alphabetizing_Posts and adapting, I modified the code to call the is_category instead. It now looks like this:
    // TO ALPHABETIZE THE POSTS
    function mw_change_post_order(){
    if ( is_category() ){
    global $wp_query;
    $args = array_merge( $wp_query->query, array( ‘orderby’ => ‘title’,’order’ => ‘ASC’ ) );
    query_posts( $args );
    }
    }
    add_action(‘genesis_before_loop’,’mw_change_post_order’);

    And it seems to work; the events are back to being listed chronologically and the regular posts alphabetically.

    I’m not experienced enough to know why or how this works better than the previous function. (So if you see something above that makes you cringe, please tell me.)
    FWIW, I tried to figure out where I got the original, wrong, code to begin with, as again I’m not experienced enough to have invented it completely on my own. I must have cobbled it together from somewhere, but beats me where.

    Thanks!

    #92602
    Brook
    Participant

    I am glad to hear you were able to get it working. I understand what you mean about cobbling stuff together, many WP developers were there are some point.

    That code looks like it will work to me. Happy site building!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Upgrade to 3.3 gets alphabetized events list archive’ is closed to new replies.