if I insert
$post_id = $instance->get('post')->post_id;
and after I insert
get_the_post_thumbnail($post_id, 'single-post-thumbnail');
it does not show nothing
if I insert $post_id to print the post_id it does not show nothing
foreach ( $date['events']['notallday'] as $instance ) {
$post_title = $instance->get( 'post' )->post_title;
$post_name = $instance->get( 'post' )->post_name;
$post_id = $instance->get('post')->post_id;
$instance_id = $instance->get( 'instance_id' );
$content .= '<div class="hp-event">
<a href="ai1ec_event/'.$post_name.'/?instance_id='.$instance_id.'">'
.$post_title.'</a><br />'.$post_id.'<br /><a class="read-more-link" href="ai1ec_event/'.$post_name.'/?instance_id='.$instance_id.'">read more</a>
</div>';
}
But if I insert instance_id it print it
foreach ( $date['events']['notallday'] as $instance ) {
$post_title = $instance->get( 'post' )->post_title;
$post_name = $instance->get( 'post' )->post_name;
$post_id = $instance->get('post')->post_id;
$instance_id = $instance->get( 'instance_id' );
$content .= '<div class="hp-event">
<a href="ai1ec_event/'.$post_name.'/?instance_id='.$instance_id.'">'
.$post_title.'</a><br />'.$instance_id.'<br /><a class="read-more-link" href="ai1ec_event/'.$post_name.'/?instance_id='.$instance_id.'">read more</a>
</div>';
}
so I tried changing the post_id with your way get_the_post_thumbnail($post_id, 'single-post-thumbnail');
and then it show to me one image but from one normal post (not all in one event calendar) and only one image. Not one image for each event.
foreach ( $date['events']['notallday'] as $instance ) {
$post_title = $instance->get( 'post' )->post_title;
$post_name = $instance->get( 'post' )->post_name;
$post_id = $instance->get('post')->post_id;
$instance_id = $instance->get( 'instance_id' );
$content .= '<div class="hp-event">
<a href="ai1ec_event/'.$post_name.'/?instance_id='.$instance_id.'">'
.$post_title.'</a><br />'.$instance_id.'<br />'.get_the_post_thumbnail($instance_id, 'single-post-thumbnail').'<a class="read-more-link" href="ai1ec_event/'.$post_name.'/?instance_id='.$instance_id.'">read more</a>
</div>';
}