Support » Plugins and Hacks » Custom Content Type Manager » [Resolved] [Plugin: Custom Content Type Manager] help about thumbnail

[Resolved] [Plugin: Custom Content Type Manager] help about thumbnail

  • Hi, I’m new to php so I followed your Overview video and on a movie page it successfully returned a lists of actors. but I also want to have the actors thumbnail to appear on the page, is this doable?

    Also on actors’ page, I want to return a list of movies with thumbnail the actor acted in (this part is automatic without having me put in movies custom fields in the actor page.)

    Thank You.


Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor fireproofsocks


    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:

    Hi, Thank you, but it would be awesome if you could provide some working sample code. no worries if you’re busy.

    Thank You.

    Plugin Contributor fireproofsocks


    Ha. I’m *always* busy. Check the FAQ, some sample code is there: http://code.google.com/p/wordpress-custom-content-type-manager/wiki/FAQ

    Ok I got it working.

    Thanks again for this great plugin!

    Plugin Contributor fireproofsocks


    Great! If you’d like to share your code, I’ll post it on the Wiki for the benefit of others.

    Hi sure

    $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">

    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:

    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];

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] [Plugin: Custom Content Type Manager] help about thumbnail’ is closed to new replies.
Skip to toolbar