• I really think this would be an excellent plug-in if I could get it to work.

    I want to display 3 Featured Images in one page with different sizes. This is what I’ve put in functions.php:

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 588, 392, true );
    
    $thumb2 = new MultiPostThumbnails(array(
    'label' => 'Secondary Image',
    'id' => 'image2',
    'post_type' => 'page'
    )
    );
    add_image_size('post-image2-thumbnail', 180, 180, true);
    
    $thumb3 = new MultiPostThumbnails(array(
    'label' => 'Tertiary Image',
    'id' => 'image3',
    'post_type' => 'page'
    )
    );
    add_image_size('post-image3-thumbnail', 180, 180, true);

    And this is what I’ve put in page.php to call the second and third thumbnails/featured images:

    <?php if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'post-image2-thumbnail')) :
            MultiPostThumbnails::the_post_thumbnail('page', 'post-image2-thumbnail'); endif; ?>
    
    <?php if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('post', 'post-image3-thumbnail')) :
            MultiPostThumbnails::the_post_thumbnail('post', 'post-image3-thumbnail'); endif; ?>

    Unfortunately this does not work ??

    I would love to work this out as I think it would be so useful for people who don’t or can’t re-size images.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    When you edit a post do you see the panel for your Secondary Image and
    Tertiary Image. I will try this with your code on my test server

    Thread Starter Rob Cubbon

    (@robcub)

    Yes, keesiemeijer, I can see the panel for your Secondary Image and
    Tertiary Image and can upload images which are then sized to the correct size in the wp-content/uploads/ … directory

    Thread Starter Rob Cubbon

    (@robcub)

    Should I have mentioned this is on an IIS server?

    Moderator keesiemeijer

    (@keesiemeijer)

    try it with this code in page.php:

    <?php if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'image2')) :
            MultiPostThumbnails::the_post_thumbnail('page', 'image2'); endif; ?>
    
    <?php if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'image3')) :
            MultiPostThumbnails::the_post_thumbnail('page', 'image3'); endif; ?>

    Moderator keesiemeijer

    (@keesiemeijer)

    this the code with the correct image sizes:

    <?php if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'image2')) :
        MultiPostThumbnails::the_post_thumbnail('page', 'image2', NULL, 'post-image2-thumbnail');
        endif; ?>
    
    <?php if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'image3')) :
            MultiPostThumbnails::the_post_thumbnail('page', 'image3', NULL, 'post-image3-thumbnail');
    endif; ?>

    Thread Starter Rob Cubbon

    (@robcub)

    Oh, keesiemeijer, that is just amazing! The second one worked (the first one put the images in in their original size).

    I think this is just a great plug-in. I can see myself using this a lot in the future.

    Thank you so much for resolving this issue.

    this worked with me

    if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'secondary-image',$post->ID)) :
        MultiPostThumbnails::the_post_thumbnail('page', 'secondary-image', $post->ID, 'fifth-image');
        endif;

    This would be a really useful plugin but….

    I have tried adding the text above to my functions file but when i update i get the following message :

    Fatal error: Class ‘MultiPostThumbnails’ not found in /homepages/40/XXXX/htdocs/testsite/wordpress/wp-content/themes/twentyten/functions.php on line 84

    Line 84 = “$thumb2 = new MultiPostThumbnails(array(”

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Multiple Post Thumbnails] displaying secondary featured images’ is closed to new replies.