• Resolved zandercent

    (@zandercent)


    HI

    I’ve build a custom layout for my event archive (archive-event.php)

    When I try to call <?php echo $EM_Event->output('#_EVENTDATES'); ?> I get the error

    Fatal error: Call to a member function output() on null in TEMPLATEURL/archive-event.php on line 36

    line 36 is the line that calls the above code

    Here’s the code

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
                    <div class="column one-third l-one-half s-one-whole">
                        <div class="event">
                            <div class="event-image">
                                <a href="<?php the_permalink(); ?>"><?php get_the_image(array('size' => 'event_square')); ?></a>
                            </div>
                            <div class="event-text">
                                <a href="<?php the_permalink(); ?>">
    
                                    <h3 class="event-title">
                                        <?php the_title(); ?>
                                    </h3>
                                    <p class="event-meta"> <?php echo $EM_Event->output('#_EVENTDATES'); ?></p>
    
                                    <span class="event-more">
                                        <?php the_excerpt(); ?>
                                    </span>
                                </a>
                            </div>
                        </div>
    
                    </div>
                <?php endwhile; else : ?>
                    <div class="column one-whole center">
                        <p>No upcoming events...</p>
                    </div>
                <?php endif; ?>

    Any thoughts?

    https://wordpress.org/plugins/events-manager/

Viewing 1 replies (of 1 total)
  • Thread Starter zandercent

    (@zandercent)

    ok found my answer – really not obvious in the documentation!

    I need to add this

    $EM_Event = em_get_event($post->ID, 'post_id');

Viewing 1 replies (of 1 total)

The topic ‘Cant display dates in an archive’ is closed to new replies.