Home › Forums › Calendar Products › Events Calendar PRO › Upgrade to 3.3 gets alphabetized events list archive
- This topic has 7 replies, 3 voices, and was last updated 12 years, 3 months ago by
Brook.
-
AuthorPosts
-
January 9, 2014 at 8:39 am #89319
Norine Leibel
ParticipantI 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.
January 10, 2014 at 5:30 pm #90328Kelly
ParticipantHi, 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?
January 11, 2014 at 4:56 pm #90550Norine Leibel
ParticipantThanks, 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’);January 13, 2014 at 1:48 pm #91430Kelly
ParticipantHi, 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.
Please let us know how it goes! 🙂
January 14, 2014 at 6:25 am #92085Norine Leibel
ParticipantThanks, 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?January 14, 2014 at 9:34 am #92249Brook
ParticipantHowdy 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
January 14, 2014 at 3:44 pm #92578Norine Leibel
ParticipantThanks 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!
January 14, 2014 at 4:27 pm #92602Brook
ParticipantI 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!
-
AuthorPosts
- The topic ‘Upgrade to 3.3 gets alphabetized events list archive’ is closed to new replies.
