• Resolved Tiarin

    (@tiarin)


    I’m trying to use this on my static homepage in a loop with get_pages.

    This is what I’m using in functions, and I can upload the secondary image just fine:

    if (class_exists('MultiPostThumbnails')) {
    
    new MultiPostThumbnails(array(
            'label' => 'Utvald bild 2',
            'id' => 'page-secondary-image',
            'post_type' => 'page'
        ));	
    
    new MultiPostThumbnails(array(
            'label' => 'Utvald bild 2',
            'id' => 'post-secondary-image',
            'post_type' => 'post'
        ));
    
    }

    And this is what I put in home.php

    <div class="list-pages-home">
    <ul>
    
    <?php
    $pageshome = get_pages('include=155,146,6'); 
    
      foreach ( $pageshome as $pagg ) {
    
        echo '<li>';
    
    if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('page', 'page-secondary-image')) {
    echo '<div id="secondaryImage">';
    	MultiPostThumbnails::the_post_thumbnail('page', 'page-secondary-image');
    echo '</div>'; }
    
    	echo '<h3><a href="' . get_permalink($pagg->ID) . '">'. $pagg->post_title.'</a></h3>';
    
        if ($pagg->post_excerpt){
          echo '<a href="' . get_permalink($pagg->ID) . '">'.$pagg->post_excerpt.'</a>';
        }
    
      }
    
       echo '</li>';
    
    ?>
    </ul>
    </div>

    I also tried to use:

    if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'page-secondary-image')) :
            MultiPostThumbnails::the_post_thumbnail('page', 'page-secondary-image'); endif; ?>

    … and various variations.

    Please help? I really want to be able to use this plugin.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Tiarin

    (@tiarin)

    Never mind, I got it working:

    echo '<span class="list-pages-home-thumb">';
    
    if (class_exists('MultiPostThumbnails')
        && MultiPostThumbnails::has_post_thumbnail('page', 'page-secondary-image',$pagg->ID)) {
        MultiPostThumbnails::the_post_thumbnail('page', 'page-secondary-image', $pagg->ID, 'home-thumb');
      }
    
    	echo '</span>';

    I’m noticing support works fine in the write post screen, however it simply does not show the thumbnail using any of the instructions provided. Thoughts, ideas or suggestions would be appreciated.

    – JC

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Multiple Post Thumbnails] Image not showing up (magazine layout)’ is closed to new replies.