Title: [Plugin: Multiple Post Thumbnails] Need help with coding
Last modified: August 20, 2016

---

# [Plugin: Multiple Post Thumbnails] Need help with coding

 *  [tobeeornot](https://wordpress.org/support/users/tobeeornot/)
 * (@tobeeornot)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-multiple-post-thumbnails-need-help-with-coding/)
 * I am having problems getting this plugin to run but have had little success getting
   it to work, even after reading past entries. I would be grateful if you could
   see if the code is right.
 * Code in functions.php:
 *     ```
       // Add secondary thumbnail (featured image) in posts */
       if (class_exists('MultiPostThumbnails')) { new MultiPostThumbnails(array
       ( 'label'  =>
       'Secondary Image', 'id' => 'secondary-image', 'post_type' => 'post'
       ));
        add_image_size('post-secondary-image-thumbnail', 176, 58, true);
   
       new MultiPostThumbnails(array(
       'label' => 'Tertiary Image',
       'id' => 'tertiary-image',
       ));
       add_image_size('post-tertiary-image-thumbnail', 176, 58, true);
   
       new MultiPostThumbnails(array(
       'label' => 'Quaternary Image',
       'id' => 'quaternary-image',
       ));
       add_image_size('post-quaternary-image-thumbnail', 176, 58, true);
       }
       ```
   
 * Code in template (I have posted the whole template code as I think you will need
   to see it in full):
 *     ```
       <?php
   
       /*
       Template Name: Home
       */
   
       ?>
       <?php get_header(); ?>
   
       <div id='main-content'>
   
           <h2>What We Do</h2>
   
           <ul id="we-do">
   
       <?php query_posts("posts_per_page=1&post_type=page&page_id=168");
                the_post (); ?>
           <!--If you want to refer to the child of parent page, use "post_parent=" -->
           <li>
               <h3><?php the_title(); ?></h3>
                <?php the_excerpt(); ?>
                <?php if (class_exists('MultiPostThumbnails')
       && MultiPostThumbnails::has_post_thumbnail('post', 'secondary-image')) :
       MultiPostThumbnails::the_post_thumbnail('post', 'secondary-image'); endif; ?>
               <a href="<?php the_permalink(); ?>" class="button">View More</a>
           </li>
   
       <?php query_posts("posts_per_page=1&post_type=page&page_id=236"); the_post(); ?>
   
           <li>
               <h3><?php the_title(); ?></h3>
               <p><?php the_excerpt(); ?></p>
               <?php if (class_exists('MultiPostThumbnails')
       && MultiPostThumbnails::has_post_thumbnail('post', 'tertiary-image')) :
       MultiPostThumbnails::the_post_thumbnail('post', 'tertiary-image'); endif; ?>
               <a href="<?php the_permalink(); ?>" class="button">View More</a>
          </li>
   
       <?php query_posts("posts_per_page=1&post_type=page&page_id=240"); the_post(); ?>
   
           <li>    
   
               <h3><?php the_title(); ?></h3>
               <?php the_excerpt(); ?>
                <?php if (class_exists('MultiPostThumbnails')
       && MultiPostThumbnails::has_post_thumbnail('post', 'quaternary-image')) :
       MultiPostThumbnails::the_post_thumbnail('post', 'quaternary-image'); endif; ?>
               <a href="<?php the_permalink(); ?>" class="button">View More</a>
         </li>
            </ul>
   
       </div><!--END main-content-->
   
       <?php get_sidebar(); ?>
   
       <?php get_footer(); ?>
       ```
   
 * I also want apply a class to the images but not sure where to place the array.
 * It might be important to note that I am also running the Featured Image functionality
   which is also registered in the functions template.

The topic ‘[Plugin: Multiple Post Thumbnails] Need help with coding’ is closed to
new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [tobeeornot](https://wordpress.org/support/users/tobeeornot/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-multiple-post-thumbnails-need-help-with-coding/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
