WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. stjohn79
    Member
    Posted 2 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'); ?>
                    </a>
    
    <?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.

    http://wordpress.org/extend/plugins/multiple-post-thumbnails/

  2. Ramzii
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic