• Hi there…I’m trying to include the event description in the list of events, and I can’t seem to get it to display. Here’s my code.

    <?php if (is_page('10')) { ?>
    
    		<hr style="margin:60px auto;" />
    
    		<?php $event_args = array(
    		    'numberposts' => 10,
    		    'orderby' => 'eventstart',
    		    'order' => 'ASC',
    		    'event_end_after' => 'now',
    		);
    
    		$events = eo_get_events($event_args);
    
    		if ($events):
    		    $return= '';
    		    global $post;
    		    $temp = $post;
    
    		    foreach ($events as $post): ?>
    
    		    <div class="singleevent grid">
    
    			<div class="col-1-4"><?php echo get_the_post_thumbnail(get_the_ID(), 'thumbnail'); ?></div>
    
    			<div class="col-3-4"><h2 class="entry-title event"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    			<div class="entry-meta">
    		        <!-- Choose a different date format depending on whether we want to include time -->
    
    			<?php if(eo_is_all_day()): ?>
    				<!-- Event is all day -->
    				<?php $date_format = 'l, F jS, Y'; ?>
    			<?php else: ?>
    				<!-- Event is not all day - include time in format -->
    				<?php $date_format = 'l, F jS, Y g:ia'; ?>
    			<?php endif; ?>
    			<?php printf(__('<p>%s</p>','eventorganiser'), eo_get_the_start($date_format) );?>
    
    			<?php if(eo_reoccurs()):?>
    				<!-- Event reoccurs - is there a next occurrence? -->
    				<?php $next =   eo_get_next_occurrence($date_format);?>
    				<?php if($next): ?>
    					<!-- If the event is occurring again in the future, display the date -->
    
    				<?php else: ?>
    
    				<?php endif; ?>
    
    			<?php else: ?>
    
    			<!-- Event is a single event -->
    
    			<?php endif; ?>
    
    			</div><!-- .entry-meta -->
    
    			</div><!-- .col-3-4 -->
    			</div><!-- .singleevent -->
    			<hr style="margin:60px auto;" />
    
    		<?php endforeach;  
    
    		    //Reset post variable
    		    $post = $temp;
    		endif; ?>
    
    <?php } ?>

    I’m wanting to pull up the event description just after the close of the .entry-meta div. If I put in the_content(); , or the_excerpt(); it just pulls up the content/excerpt from page 10, rather than from that event. Any ideas on what I’m doing wrong?

    Thanks in advance!

    https://wordpress.org/plugins/event-organiser/

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

    (@stephenharris)

    You can’t use the_content() or the_excerpt() outside of ‘the Loop’ (automatically, anyway). You either want to switch to using a WP_Query or follow this answer: http://wordpress.stackexchange.com/a/143316

    Thread Starter iamharlan

    (@iamharlan)

    I guess I’m confused. If I’m able to pull up the unique title for each event, why can’t I pull up it’s description. Am I not in a foreach loop? Is there a different function as an alternative to the_content for pulling up the event’s description?

    Thanks!

    ezramod

    (@ezramod)

    and me i try to do this i try in this mode:

    $events = eo_get_events(array(
             'numberposts'=>9,
             'event_start_after'=>'today',
    		 'group_events_by' => 'series',
    		 'orderby' => 'rand',
             'showpastevents'=>false,//Will be deprecated, but set it to true to play it safe.
    		 'tax_query'=>array( array(
                             'taxonomy'=>'event-category',
                            'operator' => 'EXIST',
                             'field'=>'slug',
                             'terms'=>array('ateliere')
                             ))
        ));
     if($events):
    	foreach ($events as $event):
              //Check if all day, set format accordingly
    $format = ( eo_is_all_day($event->ID) ? get_option('date_format') : get_option('date_format').' '.get_option('time_format') );
    
    $colors = array("#008C99","#4ECAC2","#4CBCD4","#CF571B","#7B4B4B","#7AA127","#818181","#B0B6FB","#DF9B00","#1ABC9C","#EA9D5F","#AB998F","#DE81B8","#C768A2","#F27C7E","#953D7D","#4C7296","#5F8789","#008C99","#9B59B6");
    $culoare = $colors[array_rand($colors, 1)];
     printf(
    '<div class="col-md-4">
    	<div class="border-round item shadow_ezra_block_2" style="background:'.$culoare .';">
    		<a href="%s" alt="%s" title="%s">
    		%s
    		</a>
    
    		<div style="opacity: 1.0!IMPORTANT;">
    		<h4 class="culori_array">
    		<span class="fa fa-smile-o"></span> %s
    		</h4>
    		<div class="the_excerpt">
    			%s...
    		</div>
    </div>
    		<div class="read-more ezra_press"><a href="%s"><i class="fa fa-chevron-right"></i></a></div>
    	</div>
    </div>',
    
    			get_permalink($event->ID),
                get_the_title($event->ID),
                get_the_title($event->ID),
    			get_the_post_thumbnail($event->ID, 'home360-thumbnail'),
                get_the_title($event->ID),
    			substr(get_the_excerpt($event->ID), 0,150),
    			get_permalink($event->ID),
                 eo_get_the_start($format, $event->ID,null,$event->occurrence_id)
              );
    	endforeach;
    	endif;

    but for me show same content for all 9 post

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Event List excerpt not working…??’ is closed to new replies.