I’m using Events Manager plugin.
I want to list upcoming events without widget. (2 event with big thumbnail image, after then 4 event with small thumbnail image.)
Tried this code:
<?phpfunction em_mod_custom_events_list(){
$events = EM_Events::get(array('scope'=>'future','limit'=>10));
?>
<table>
<tbody>
<?php
$start = false;
$limit = 3;
$count = 1;
foreach( $events as $EM_Event ){
?>
<?php if ( !$start ) { ?>
<tr>
<?php $start = true; ?>
<?php } ?>
<td><?php echo $EM_Event->output("#_EVENTLINK"); ?></td>
<?php
if ( $count === $limit ){
?>
</tr>
<?php
$start = false;
$count = 1;
}else{
$count++;
}
?>
<?php
}
?>
</tbody>
</table>
<?php
}
add_shortcode('custom_events_list', 'em_mod_custom_events_list');
but I’m taking “Warning: Illegal offset type in isset or empty” error message.
I wrote this query;
<?php
$args = array(
'posts_per_page' => 4,
'post_type' => 'event',
'offset' => 2,
'meta_query' => array(
array(
'key' => 'event_start_date',
'value' => date('d/m/Y'),
'compare' => '>=',
'type' => 'DATE'
)
),
'post_status' => 'publish',
'meta_key' => 'event_start_date',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
query_posts($args);
while (have_posts()) : the_post(); ?>
I did not get a result..
How can I do it?
Thanks…
///Edit
Tried this code, it works.
<?php
$events = EM_Events::get(array('scope'=>'future', 'limit'=>6));
foreach( $events as $EM_Event ){
?>
<div class="tn-small-1 blocky" style="min-height:105px;margin-bottom:0;">
<a href="https://wordpress.stackexchange.com/questions/165758/<?php echo $EM_Event->output("#_EVENTURL"); ?>"><img src="https://wordpress.stackexchange.com/questions/165758/<?php echo $EM_Event->output("#_EVENTIMAGEURL"); ?>" width="105" height="85" class="lefty"></a>
<h4 class="lefty" style="width:100%"><?php echo $EM_Event->output("#_EVENTLINK"); ?></h4><br>
<p class="righty" style="max-width:253px;"><b>Tarih:</b><?php echo $EM_Event->output("#_EVENTDATES"); ?></p>
</div>
<?php } ?>