Is there a way to order automatically order events by event date?

Is there a way to order automatically order events by event date rather then post date? My client wants to arrange the events with the next calendar event listed at the top and so on. I know that it is possible to fool Events by manually messing with the post dates, but this is a pain when there are a lot of events and then you have a new one that is scheduled in the middle of the calendar timeline. Please help!

  • PC
    • WPMU DEV Initiate

    Hello there nfisher,

    Thanks for posting back.

    I just did a quick test on your site and it works fine. I added a new event today with the dates being of this month (so that it can be before the next event on your list) and it automatically appeared on the top of the list. No issues at all.

    Here is a screenshot :

    Cheers PC

  • nfisher
    • Site Builder, Child of Zeus

    Sure, if I want the event to post at the top of the list then its not a problem. But the problem occurs when I want to schedule a new event that should appear in the middle or the bottom of the list. Try posting an event dated Sept 30th, for example, and though it belongs at the 2nd from the bottom slot on the list, it will still appear at the top.

    How do I make them appear in correct date order?

  • PC
    • WPMU DEV Initiate

    Hiya,

    You are right. It does not work properly but I found its due to the theme. The theme you are using is causing the template show the events in order dates are posted.

    As soon as we override default appearance, the issue no longer appears.

    You will need to create a custom events archive template in your theme to suit your needs. Are you comfortable doing that yourself ?

    Please advise otherwise I will arrange for help accordingly :slight_smile:

    Cheers, PC

  • Jose
    • Bruno Diaz

    Hi again @nfisher,

    Hope you are doing great!

    I changed some things in your site to list the Events in the expected order.

    The problem is that you are using a fantastic yet very intrusive theme. So hacking the template is a bit more complicated.

    What I did is to create a specific layout for the Events page, added the Upcoming Events widget, and then applied some CSS to make it look the same as the post loop. (see images attached).

    You can add some more CSS and also change the config in the widget to show or hide information.

    Have a nice day and thanks for your patience here!

  • nfisher
    • Site Builder, Child of Zeus

    Thank you, Jose! I appreciate your help. Two things I noticed are different:

    1) The update button on events is now grayed out and I cannot use it, therefore I cannot save or change events.

    2) In the events list, only one of them will direct to the details page about that event. The others don't seem to work.

    Any thoughts on what is happening? Thanks again.

  • Jose
    • Bruno Diaz

    Hey @nfisher,

    Please try again now.

    The "Ultimatum" theme rules to assign layouts seems to take his own decisions... It was using the Event list layout for single event content. I enforced the rules to use "Main content layout" for single event content.

    As a side note, I'm glad to help you to sort this out, just want to make clear that all this issues were related to Ultimatum framework actually. They don't have a public documentation though, so for future issues it would be handy to reach their support team and request some info. In that way we can assist you more efficiently. :slight_smile:

    For the update button being grayed out (I assume you are talking about the button in the attached image), it is not related to the changes that I made. Actually, it is behaving in the same way in my clean installation so there might be another problem. In the meantime, you can workaround this by changing something under "Event times and dates" (just change something and then rollback) and the update button will be enabled again.

    Hope this helps.

    Take care!
    JJ

  • nfisher
    • Site Builder, Child of Zeus

    Thanks for the help, Jose. I can now open all five events that are displayed. I can also save changes to these events by doing what you suggested. The weird thing is that there are nine published upcoming events in the events post list, but four of them do not show up, and new events that I create don't show up either. I was analyzing the ones that do and the ones that don't, and I cannot see a difference between them as to why only five show up in the list on this page: http://www.shilohplace.org/events/

    An FYI about the Ultimatum framework is that you can connect with it similar to the way that WPMU connects its plugins to the Genesis framework. A similar problem was just solved this week with the MarketPress plugin over on this thread: https://premium.wpmudev.org/forums/topic/something-got-messed-up-in-a-recent-marketpress-update

    Onur Demir is the head developer of the Ultimatum framework and he is also a WPMU-DEV member. He created the code that fixed the MarketPress issue. His profile is here: https://premium.wpmudev.org/forums/profile/onurdemir
    I do not know how to message other WPMU members in the context of this forum, but I thought maybe you might know. I hope this helps.

  • Jose
    • Bruno Diaz

    Hey @nfisher,

    It is showing all the events now.

    You can see in the attached images, that you can change the layout of the page under Theme Managment -> Edit Layout.
    There, you will find that I added the widget "Upcoming Events". It was looking also for the next 10 weeks ahead. I changed it to the maximum value.

    Please notice that this widget has a max limit of 10. So you can show up to first 10 upcoming events.

    Cheers,
    JJ

  • nfisher
    • Site Builder, Child of Zeus

    It's looking good! Thanks JJ!

    Will I lose any of these changes that you created for me if I update the Events plugin? Or if I update Ultimatum in future updates? Should I save that code info somewhere? Thanks again!

    • Jose
      • Bruno Diaz

      Hey @nfisher,

      I missed your reply in the queue somehow.
      In theory, the changes won't be altered by an update neither of Events plugin or Ultimatum framework.

      But anyway, it's always a good idea to save regular backups. :slight_smile:

      I'll mark the thread as resolved, but feel free to re-open it if there is something else that need to be sorted.

      Cheers!

  • Onur Demir
    • New Recruit

    Hello there,

    Unlike MarketPress this plugin is written with Templates which can be owerwritten by theme as I see. (it has default-templates folder which i suppose does it)

    The Ultimatum Loop is called via action ultimatum_loop and the function we call is ultimatum_standard_loop

    So basically if you were to copy all templates in this plugin to the theme level (child theme ofcourse)
    and edit them to be shown in loop it would be an easy task

    Just for one file :
    archive-inscub_event.php

    <?php
    global $booking, $wpdb, $wp_query;
    /** Remove default Ultimatum loop */
    
    remove_action( 'ultimatum_loop', 'ultimatum_standard_loop' );
    /** ADD the archive-inscub-loop ;)
    add_action('ultimatum_loop', 'ultimatum_archive_inscub_event');
    function ultimatum_archive_inscub_event() {
    	ultimatum_archive_inscub_event_content();
    }
    function ultimatum_archive_inscub_event_content(){
    ?>
    	<div id="primary">
    		<div id="content" role="main">
                <div id="wpmudevevents-wrapper">
                    <h2><?php _e('Events', Eab_EventsHub::TEXT_DOMAIN); ?></h2>
                    <hr/>
                    <?php if ( !have_posts() ) : ?>
                        <p><?php $event_ptype = get_post_type_object( 'incsub_event' ); echo $event_ptype->labels->not_found; ?></p>
                    <?php else: ?>
                        <div class="wpmudevevents-list">
    
                        <?php while ( have_posts() ) : the_post(); ?>
                            <div class="event <?php echo Eab_Template::get_status_class($post); ?>">
                                <div class="wpmudevevents-header">
                                    <h3><?php echo Eab_Template::get_event_link($post); ?></h3>
                                    <a href="<?php the_permalink(); ?>" class="wpmudevevents-viewevent"><?php _e('View event', Eab_EventsHub::TEXT_DOMAIN); ?></a>
                                </div>
                                <?php
                                    echo Eab_Template::get_event_details($post);
                                ?>
                                <?php
                                    echo Eab_Template::get_rsvp_form($post);
                                ?>
                                <hr />
                            </div>
                        <?php endwhile; ?>
                        </div>
                    <?php endif; ?>
                </div>
                <?php posts_nav_link(); ?>
            </div>
    	</div>
    <?php }

    the same can be done for each file called via templates so that they will only alter the WP Default loop in Ultimatum and user can use the design of their desire easily.

  • Dharmendra
    • The Incredible Code Injector

    Hello @nfisher,

    I hope you are well today and I'm glad to hear that you got it working that's fantastic! :slight_smile:

    If you have any issues, please don't hesitate to let us know so we can assist.

    @Onur Demir
    Thanks for chipping in though, and trying to help, really appreciate that! :slight_smile:

    Thank you for being a WPMU Dev Member!

    Take care and have a fantastic day! :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.