• Forgive me if this post is annoying! I swear I’ve read all of the docs and followed the instructions to the best of my ability. I can’t get an image to display…

    Here’s what’s in my functions.php:

    if (class_exists('MultiPostThumbnails')) {
    
        $types = array('post', 'page');
    
        foreach($types as $type) {
    	    new MultiPostThumbnails(
    	        array(
    	            'label' => 'Secondary Image',
    	            'id' => 'secondary-image',
    	            'post_type' => 'page'
    	        )
    	    );
    	}
    }

    Here is what is in my front-page.php file.

    if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif;

    I also tried this:

    if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail('page', 'secondary-image'); endif;

    https://www.ads-software.com/extend/plugins/multiple-post-thumbnails/

Viewing 1 replies (of 1 total)
  • Plugin Author Chris Scott

    (@chrisscott)

    First, you should change the functions.php code:
    'post_type' => 'page'
    to
    'post_type' => $type

    However, the issue with displaying it in front-page.php is likely due to you not being in a loop when calling MultiPostThumbnails::the_post_thumbnail(). If that’s the case you need to pass in the post type explicitly as the first argument since get_post_type() won’t work out of the loop (or may have unexpected results).

Viewing 1 replies (of 1 total)
  • The topic ‘Can't get image to display, need help…’ is closed to new replies.