• Resolved Kip Kniskern

    (@kip-kniskern)


    I am working on a new site and have been trying out The Events Calendar, using 3.0.3. Today, I upgraded it to 3.1, and now the events have jumped to the top of my main index list (they were sorted by publish date up until now, to the best of my knowledge).

    I have “Include events in main blog loop” checked, and I did add in the body class (which I did not use before, although 3.0.3 sorted the posts correctly).

    How can I sort my index so that all the upcoming events aren’t bunched up at the top of the list?

    (sorry the site isn’t public at the moment, a work in progress)

    https://www.ads-software.com/plugins/the-events-calendar/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Kip Kniskern

    (@kip-kniskern)

    I’ve done a bit more checking – the “publish date” is indeed the post creation date, that is, the Events post editor shows the creation date as date published, but php the_time shows the Start date and not the publish date, and the posts are sorted by the start date, and not the creation date of the post. I have enabled a function to add events posts to our RSS feed (which I would like to have happen), and to confuse matters more, those RSS feed posts are in the correct order of creation (using the built in feed capabilities of WP 3.6.1).

    As I said before, this is new behavior to 3.1, and will be a showstopper if I can’t get it figured out, sorry to say. We would like to use The Events Calendar as a sort of sub-blog, posting news about upcoming events in our blog timeline. But this is not going to work if the posts remain at the top of the blog for days, weeks, or even months until the event passes.

    Also: unchecking, refreshing, and then rechecking the “include events in index” checkbox does not solve the issue.

    Thread Starter Kip Kniskern

    (@kip-kniskern)

    Reverting back to 3.0.3 gets the index sorted properly.

    Hi Kip, I believe this changed in response to feedback from our customers – so now they are sorted by event start date.

    Thread Starter Kip Kniskern

    (@kip-kniskern)

    “Thanks”

    As I said before, this is (or would be) a showstopper. We plan on using Events to track upcoming Tech events, and so need to “post” the event when it is announced, and to show as a blog post. By having the events sort by the event date and not the publish date, our index.php would show any and all events happening in the future before our latest news posts, obviously unacceptable.

    FWIW I have found a workaround. After upgrading to 3.1, I unchecked the “include Events in main blog loop” checkbox in settings, and inserted the following code into functions.php:

    add_filter( 'pre_get_posts', 'my_get_posts' );
    
    function my_get_posts( $query ) {
    
    	if ( is_home() && $query->is_main_query() )
    		$query->set( 'post_type', array( 'post', 'tribe_events' ) );
    
    	return $query;
    }

    (code snippet via Justin Tadlock)
    The WordPress posts query apparently uses publish date to sort, it wasn’t necessary to resort the Events code.

    By the way, I have also added code to incorporate Events posts into our RSS feed, too:

    function myfeed_request($qv) {
    	if (isset($qv['feed']) && !isset($qv['post_type']))
    		$qv['post_type'] = array('post', 'tribe_events');
    	return $qv;
    }
    add_filter('request', 'myfeed_request');

    This allows us to use Events posts almost as though they were regular blog posts, showing up on our home page and in our feed.

    The Events Calendar is by far the most useful events plugin we’ve found, and I’m happy to have it working (for our purposes) “properly”. I would suggest that you take a look at the functionality of adding events to the home page and think about providing a “blog flow” option based on publish date in the future. For now, though, I can live with this and continue to install updates, etc.

    We are indeed looking at providing an alternative means of flowing the events into the main blog loop, whether by adding a setting or offering a tutorial that includes a suitable snippet.

    “Thanks”

    As I said before, this is (or would be) a showstopper.

    We can appreciate that – but we do have to go by the opinions of our customer base and prior to this change it was overwhelmingly that the current approach was better and so we made a judgement call as we often have to do – that of course has, unfortunately, caused issues for another part of our customer base and I’m sure you understand the intention was not to cause disruption.

    I’m glad to hear you’re all sorted here though – and thank you for sharing your end solution ??

    Hey Kip – just a heads up that we are releasing a 3.2 build over the next week or so that should incorporate better handling of this. Please let us know if you don’t find it a smoother experience upon upgrade. Thanks for your patience so far!

    Thread Starter Kip Kniskern

    (@kip-kniskern)

    Appreciate the heads up, looking forward to it ??

    3.2 is now available!

    Thread Starter Kip Kniskern

    (@kip-kniskern)

    Thanks.

    I’ve installed 3.2, but unless I’m missing something everything in my scenario still works as previously. Which is fine, I am happy with the code snippet to add “tribe-events” to posts on the home page (adding them by post date and not event date). I do not see anything in 3.2 that would change or allow this behavior via the interface, though.

    Just to be clear, here’s our scenario. Our home page is a (tech/Microsoft related) blog. I’ve added a dedicated Events section, where the List and Calendar show up, listing Events (upcoming tech events, earnings statements, etc.) by event date. However when a new event is announced, our old procedure was to do a blog post on it.

    Now, we will just add the Event to the calendar, and the single event will show up (also) on the home page as an announcement of the event (sorted by the date of the announcement, not the date of the event, which would fill the top of the home page with future events and crowd out current non-event news).

    For example, I’ve added CES in January as an event. I would not want that riding the top of the home page for the next two months!

    As I said before, I’m very comfortable with the functions.php code, and if your customers require sorting by Event date on the home page (not sure I quite understand why anyone would want that in their blog, but whatever), then this is an easy workaround, allows me to keep up with the latest versions of The Events Calendar and still get the functionality I need.

    Keep up the good work and thanks for keeping me posted.

    Great: the main thing here is that you are able to workaround things and get everything running in the way that suits your site. Thanks again for your support and patience.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘3.1 Main Index now sorting by event date and not publish date’ is closed to new replies.