I posted this over in pre-sales but went ahead and purchased to get an answer. I’ve written a custom loop (once using eo_get_events and another using wp_query). In both instances I am unable to use the_excerpt or the_content to display the events content. Oddly enough echo get_the_content() works just fine in both loops, but echo get_the_excerpt() does not. I have Excerpts checked in settings as a supported feature for Events.
I have no idea how the_content would not work but echo get_the_content would. Any ideas on why this would be happening? I’ve tried it on two separate wordpress installations (one local, one on a server)
<?php
//Get upcoming
$args = array(
'numberposts'=>3,
'event_start_after'=>'today',
'showpastevents'=>true,
'post_type'=>'event',
'suppress_filters'=>false
);
$eventloop = new WP_Query( $args );
if ( $eventloop->have_posts() ) :?>
<?php
while ( $eventloop->have_posts() ) : $eventloop->the_post();
?>
-
'>
<h5><?php the_title(); ?></h5>
on <?php eo_the_start('jS F Y'); ?>
<?php the_excerpt(); ?>
<?php
endwhile;
wp_reset_postdata();
?>
<?php
else :
echo 'No Upcoming Events';
endif;
?>

Josh Rives
Nevermind…I figured it out. It was another custom function not this plugin. Thanks

Josh Rives
Hi Josh,
eo_get_events()
– is a bit like get_posts()
in that functions like the_content()
, won’t work (without a little bit of a work-around).
However, it should work fine with WP_Query()
and $eventloop->the_post()
. It’s also really odd behaviour that echo get_the_content()
works but the_content()
doesn’t. Looking at the source you’ll see that the_content()
just uses get_the_content()
and applies a filter to it. So typically they’ll work or fail together.
That the_content()
isn’t working, points to a plug-in or theme doing something on the_content
filter ( probably that is changing the global $post
). Testing (code below) on a ‘blank’ (almost) install, I don’t get any issues. So it suggests it’s probably another plug-in or theme responsible. I’d recommend disabling all other themes/plugins to see if the issue persists (and if not, which plugin/theme was responsible).
Also, where have you used this code? Context may also play a role (I placed the test code below in TwentyThirteen’s header.php
.)
Test code:
<?php
$args = array(
'numberposts'=>3,
'event_start_after'=>'today',
'showpastevents'=>true,
'post_type'=>'event',
'suppress_filters'=>false
);
$eventloop = new WP_Query( $args );
if ( $eventloop->have_posts() ) :
while ( $eventloop->have_posts() ) : $eventloop->the_post();?>
<h5><?php the_title(); ?></h5> on <?php eo_the_start('jS F Y'); ?>
<hr>
<h6> Excerpt </h6>
<?php the_excerpt(); ?>
<hr>
<h6> Echo (get the) content </h6>
<?php echo get_the_content(); ?>
<hr>
<h6> The content </h6>
<?php the_content(); ?>
<hr>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php
else :
echo 'No Upcoming Events';
endif;
?>

Stephen Harris