Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #6189
    piotrly
    Participant

    After upgading Event Maker to v 1.5.0 sorting of my regular posts changed – the oldest news are at top of page. When I disable this plugin, sorting is back as normal (newer posts are first).

    #6190
    Bartosz
    Keymaster

    Thx @piotrly,

    Checking this.

    #6192
    Bartosz
    Keymaster

    Can you do some code modifications on your site to check if that solves the issue?

    Go to plugin folder/includes/class-query.php

    Find alter_orderby_query function, line 741 and right after this:

    if (is_admin())
    	return $query;
    
    if (empty($query))
    	return $query;

    insert this:

    $post_types = $query->get('post_type');
    
    // does query contain post type as a string or post types array
    if(is_array($post_types))
    {
    	// check if there are defferrnces between the arrays
    	if((bool)array_diff($post_types, apply_filters('em_event_post_type', array('event'))))
    		// at least one of the post_types is not an event post type, don't run the query
    		$run_query = false;
    	else 
    		// all the post type are of event post type
    		$run_query = true;	
    }
    else
    	$run_query = (bool)in_array($post_types, apply_filters('em_event_post_type', array('event')));
    
    // do sorting or not
    if(!$run_query)
    	return $query;
    #6194
    piotrly
    Participant

    Great, it works! Thanks.

    #6195
    Bartosz
    Keymaster

    Did you notice any other issues? There were some heavy modifications of the code.

    #6196
    piotrly
    Participant

    I’m not sure if it’s related with this change but when I enabled plugin, links to events doesn’t work. So I can’t check if everything is ok with events page. But even if I restore class-query.php, links are still not working. Maybe it need some time to refresh and it’s related with disabling and enabling of plugin.
    But definitely it fixed order of my posts.

    #6197
    Bartosz
    Keymaster

    Just re-save your permalinks. That’s what usually helps.

    #6198
    piotrly
    Participant

    Thanks for tip, it worked. Everything seems fine with events, it looks like earlier.

    I noticed one strange thing – but it’s independent if I use modified class-query.php or not. I have only one future event and when I enabled displaying past events and on page with list of events I changed order (from drop-down list) to descending my past event from 9 March is first, then my future event from 8 April and then event from 11 February. Maybe it’s some other bug:
    http://powietrze.malopolska.pl/en/wydarzenia/?orderby=event_end_date-desc

    Edit: in ascending order is also wrong

    #6199
    piotrly
    Participant

    Ok, I checked that default view has right order but changing order (from drop-down list) to descending or ascending couses that order is wrong.

    #6200
    Bartosz
    Keymaster

    Hmm, strange. It behaves the same if you change ordering and then switch to start date asc again.

    Piotr, we’ll try to find what is the logic here and I’d be greatuful if you do the same on your site (nice one, by the way)

    #6201
    Bartosz
    Keymaster

    Yeah, but for one or first item only.

    #6202
    piotrly
    Participant

    Ok, I’ll try several options in the evening by adding new events.

    #6203
    piotrly
    Participant

    There was something wrong with this particular event. I don’t know reason of this but I deleted this event and added it again with the same date. Sorting is working fine now.

    #6204
    Bartosz
    Keymaster

    Did your create that one by duplicating it?

    #6206
    piotrly
    Participant

    No, I just created new one and copied description.
    I was testing creating new events and all worked fine except this one.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.