Yes, it’s possible, it just requires a bit more footwork to get the thumbnail. You can use the wp_get_attachment_image_src() or the wp_get_attachment_image() functions to retrieve an image given its ID, or try get_the_post_thumbnail(). If you are getting a list of actors, the thumbnail ID is stored inside a hidden field named “_thumbnail_id” — that ID is what you want to pass to the WP functions. If you’ve stored the thumbnail as a custom field and NOT as the default WP “featured-image”, then you’d use the custom field name to retrieve the ID.
Re retrieving a list of movies featuring a given value, see the http://code.google.com/p/wordpress-custom-content-type-manager/wiki/TemplateFunctions page, specifically this function:
http://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts_sharing_custom_field_value
Hi, Thank you, but it would be awesome if you could provide some working sample code. no worries if you’re busy.
Thank You.
Ok I got it working.
Thanks again for this great plugin!
Great! If you’d like to share your code, I’ll post it on the Wiki for the benefit of others.
Hi sure
<?php
$actor_thumb = get_custom_field('Actors:to_array', 'get_post');
foreach ($actor_thumb as $at) {
$thumbpermalink = get_permalink( $at['ID'] );
$thumb = wp_get_attachment_image_src($at['_thumbnail_id']);
?>
<a href="<?php echo $thumbpermalink ?>" title="<?php echo $at['post_title']; ?>" >
<img src="<?php echo $thumb[0]; ?>" width="100" height="150">
</a>
<?php
}
?>
I only need the first part of my problem, second part I will use another plugin called “List category posts”, it have some options best suits my needs.
how to access a specific image sizing for an image field in CCTM:
add to functions:
add_image_size( 'contenttype-thumb', 216, 9999 ); // 216 is the width, set to whatever, 9999 is ignored (or swap to set height)
add_theme_support( 'post-thumbnails', array( 'contenttype' ) );
add to template page within loop:
<?php
global $post;
$fieldname = 'large_poster'; //the image field name
$image_id = get_post_meta($post->ID, $fieldname, true);
$images = wp_get_attachment_image_src( $image_id, 'contenttype-thumb', true);
echo $images[0];
?>