Multiple Post Thumbnails
[resolved] Link thumbnail image to post (2 posts)

  1. stjohn79
    Posted 4 years ago #

    Here's how to link a multiple-thumbnail image to its associated post.

    The regular code that goes in the loop to display a "Secondary" image looks like this:

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

    To link this image to its post do this instead:

    <?php if (class_exists('MultiPostThumbnails')
        			&& MultiPostThumbnails::has_post_thumbnail('post', 'secondary-image')) : ?>
           			<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
                    	<?php MultiPostThumbnails::the_post_thumbnail('post', 'secondary-image'); ?>
    <?php endif; ?>

    This adds the permalink to the image as described in function reference on thumbnails. http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    I hope that's helpful to someone.


  2. Ramzii
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Multiple Post Thumbnails
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic