• Resolved mynym

    (@mynym)


    In order to sort past events with the latest event on top, I added this to my custom functions.php:

    function tribe_past_reverse_chronological ($post_object) {
    	$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'past') ? true : false;
    	if(tribe_is_past() || $past_ajax) {
    		$post_object = array_reverse($post_object);
    	}
    	return $post_object;
    }
    add_filter('the_posts', 'tribe_past_reverse_chronological', 100);

    It works, unless I click on the “past events” (“Vorherige Veranstaltungen”) from the list of future events: In this case, all past events are sorted with the first on top. Only after reloading the page, the events appear in the correct order.

    You can check this behavior here:

    1. go to the list of current events:
    http://impact-akademie.com/veranstaltungen/list/?tribe_paged=1&tribe_event_display=list

    2. select “Vergangene Veranstaltungen”

    3. Please reload to see the order changing.

    Thanks for ideas on why this happens and how I can display past events in the right order on first loading the page.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter mynym

    (@mynym)

    The link in the example reads “Vorherige Veranstaltungen”…

    Barry

    (@barryhughes-1)

    I’m sorry to say that here on the wordpress.org forums our capacity to support custom dev work and customizations generally is rather limited, simply because we are experiencing high load on our premium forums and in all fairness need to support those users first and foremost.

    Since by the sound of things this issue relates only to a scenario that happens with the custom code you added, I doubt this is something we can help with directly.

    Perhaps a fellow community member will be able to chime in and assist, though?

    Good luck with the project 🙂

    Thread Starter mynym

    (@mynym)

    Thanks Barry for your reply.

    The snippet that is not working properly is from your website, you published it in your knowledge base (https://theeventscalendar.com/knowledgebase/show-past-events-in-chronological-order/).

    I posted the issue in your knowledge article feedback. If you answer the question over there, please just let me know…

    Best
    Wolfgang

    Thread Starter mynym

    (@mynym)

    PS: I also added the issue as a remark at github, where you provide the code as a download:
    https://gist.github.com/theeventscalendar/27b25dc4e5e4ea7e3f31

    Plugin Contributor Andras Guseo

    (@aguseo)

    Hi @mynym,

    Thanks for sharing that with us.

    Did your issue get resolved since? Let me know.

    Cheers,
    Andras

    Thread Starter mynym

    (@mynym)

    Hi Andreas,

    Unfortunately, the problem still prevails: Events sort “latest on top” only after manually reloading the page when entering the archive through the “earlier events” link from the current events page…

    Any ideas on the cause and how to tackle it are still welcome!

    Best
    Mynym

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘right order of past events only after reload’ is closed to new replies.