• Resolved notkristina

    (@notkristina)


    Hi Stephen,

    I don’t recall noticing this problem prior to updating to 3.6, but currently my event category archive pages aren’t outputting anything for eo_the_start().

    Also, past events are appearing on the page, even though the settings specify that they shouldn’t be.

    I think if this had been the case when I was first writing the templates and styling the pages, I’d have noticed at least the missing dates, so I’m guessing this is a new problem and could be related to the core update. Of course, the eo_the_start() works fine on singles and the main archive, so I’m stumped! Any ideas?

    https://www.ads-software.com/plugins/event-organiser/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Hi,

    Nothing’s changed with that function in a long time, and there’s no conflict between EO and WP 3.6.

    Given events that are appearing when they shouldn’t, and date/time is not being displayed, I think its probably another plug-in (or theme) interfering with the SQL. So I’d recommend disabling other plug-ins to determine if there is a conflict, and if so, which one is conflicting with it.

    Hi,

    For me, the eo_the_start() function was not working for events that are displayed on the front page, so I used eo_get_next_occurrence() instead.

    Since I updated to wordpress 3.6.1, past events appear on the front page with no date returned by eo_get_next_occurence(), whereas prior to the update, deselecting “display past events” would not display past events on the front page. Maybe there is some kind of a “eo_is_past()” function that I could use as a workaround ?

    Event Organiser is the only activated plugin that I have, so there is no conflict with another plugin.

    Plugin Author Stephen Harris

    (@stephenharris)

    That’ll depend on how you’re displaying events on the front-end… if you’re querying events along with other post types, then I think they get treated as posts, and so the dates aren’t pulled from the database.

    The setting for displaying past events is probably being ignored on the front-page for similar reasons – it’s not an ‘event query’ because it includes other post types (I’m guessing).

    I found somewhere in the forums that this piece of code should be added to the functions.php file so that events would be displayed on the front page :

    add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
    
    function add_my_post_types_to_query( $query ) {
                    if ( is_home() && $query->is_main_query() )
                                            $query->set( 'post_type', array( 'post', 'event' ) );
                            return $query;
    }

    This is my content.php file :

    <div class="entry-content">
                            <?php if ( 'event' == get_post_type() ) : ?>
                                    <div class="event-entry-meta">
                                    <?php eo_get_template_part('event-meta','event-single');  ?>
                                    </div>
                            <?php endif; // End if 'event' == get_post_type() ) ?>
                            <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
                            <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
                    </div><!-- .entry-content -->

    Then in event_meta_event_single.php I use :

    <?php if( !eo_reoccurs() ){ ?>
                                    <!-- Single event -->
                                        <?php printf("<p> Le %s", eo_get_next_occurrence($date_format)) ; ?>
                                    <?php
                     } ?>

    Maybe this is not the recommended method for displaying events on the front page ? Anyway, the upcoming events have the date displayed.

    Another issue is that events now show in the order they where posted, not in the order relative to the date of the event as they did before. (I don’t know if this is due to the WP core update or the Event Organiser update).

    https://laretive.info/

    Plugin Author Stephen Harris

    (@stephenharris)

    Yup, that’s because you’re mixing event post types with other post types. Because it doesn’t make sense to order ‘posts’ by event date, or subject to event conditions everything gets treated like a post.

    You can have events on the front-end, but queries for events must only be for events. So you could have events listed separately, in a widget, and you can have it as the ‘main loop’ of the page (but not have posts in there too).

    OK, so I did

    function add_my_post_types_to_query( $query ) {
                    if ( is_home() && $query->is_main_query() )
                        $query->set( 'post_type', array( 'event' ) );
                            return $query;
    }

    to have only the events displayed on the front page, and it works fine now.

    Thanks !

    Hello, I think we ran into this. We added ‘post’ as well as ‘event’ to the front page and the dates won’t show up. What would be the best way to show them together?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘eo_the_start() missing from category archive’ is closed to new replies.