Forum Replies Created

Viewing 1 replies (of 1 total)
  • 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];
    ?>

Viewing 1 replies (of 1 total)