Hi Stephen! I’m in a classic situation where I’m unsure who to ask as there’s more than one plugin involved – and it may just be core WordPress stuff – but I’m going with my hunch that you’re the one to ask!
I’m trying to display a custom thumbnail in my event archive (I have a copy of archive-event.php in my theme). I’ve already successfully done this in my customized shortcode-event-list.php template. But the same code doesn’t work when I transfer it over to the archive template. I realize there’s usually more to it than that, but you never know… sometimes that works… 8^)
My shortcode-event-list starts with this:
global $eo_event_loop,$eo_event_loop_args;
//Date % Time format for events
$date_format = get_option('date_format');
$time_format = get_option('time_format');
//The list ID / classes
$id = ( $eo_event_loop_args['id'] ? 'id="'.$eo_event_loop_args['id'].'"' : '' );
$classes = $eo_event_loop_args['class'];
?>
and grabs my custom thumbnail with this:
<?php
$image_ids = get_post_meta($post->ID, 'poster');
foreach ($image_ids as $image)
{
$myupload = get_post($image);
echo wp_get_attachment_image( $image, 'poster-thumb' );
}
?>
My archive-event.php, by contrast, uses a slightly different approach to show the standard square thumbnail:
<h1 class="entry-title" style="display: inline;">
<?php
//If it has one, display the thumbnail
the_post_thumbnail('thumbnail', array('style'=>'float:left;margin-right:20px;'));
?>
The best I could do after transferring the first block of code into the second file was to at least “minimize” the error messages but not to eliminate them or get this to work.
I have definitely done research and looked at the EO docs, but am feeling lost and hope you can at least point me in the right direction…
Thanks!
adam

Adam Abrams
Does
<?php
$image_ids = get_post_meta( get_the_ID(), 'poster');
foreach ( $image_ids as $image ) {
$myupload = get_post( $image );
echo wp_get_attachment_image( $image, 'poster-thumb' );
}
?>
work?

Stephen Harris
Works like a charm, Stephen!
Just when I think I have this whole PHP / WordPress thing kinda sorted out, I hit a roadblock like this… sigh… what’s the diff between get_the_ID() and $post->ID ? Clearly they’re not interchangeable…
Anyway – thanks SO much for this! 8^)

Adam Abrams
$post->ID
will only work if its been defined, and typically it refers to the global variable. So the two are almost the same, but certainly not interchangeable. get_the_ID()
will always work if $post->ID
works, but not necessarily vice versa. ( see function definition: http://queryposts.com/function/get_the_id/ )

Stephen Harris
Thanks Stephen for the info and link. Looks like i have some good reading ahead of me! 8^)

Adam Abrams