Multiple Post Thumbnails Plugin
-
I am having problems getting this plugin to run but have had little success getting it to work, even after reading past entries.
I have activated the plugin and placed the following code into the functions template to register multiple images:
// 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); }
I have then used the following code in the relevant 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 ‘Multiple Post Thumbnails Plugin’ is closed to new replies.