WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Multiple Featured Images] Can't get this plugin to work with my theme.. (1 post)

  1. kaspar wimberley
    Member
    Posted 2 years ago #

    The theme uses a posts featured image in both a slider and in the loop. The two instances require different sizes (not the same aspect ratio). I can get one working by uploading images of the right size, but then the other appears stretched, and visa versa. I thought the solution might be to use your/this plugin, but I can't work out how to integrate it with existing code.

    Here are the relevant bits.

    Theme functions for extra image sizes/thumbnails:

    function sight_setup() {
    	update_option('thumbnail_size_w', 290);
        update_option('thumbnail_size_h', 290);
        add_image_size( 'mini-thumbnail', 50, 50, true );
        add_image_size( 'slide', 640, auto, true );
        register_nav_menu('Navigation', __('Navigation'));
        register_nav_menu('Top menu', __('Top menu'));
    }

    loop code:

    <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
                <?php if ( has_post_thumbnail() ) :?>
                <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
                            'alt'	=> trim(strip_tags( $post->post_title )),
                            'title'	=> trim(strip_tags( $post->post_title )),
                        )); ?></a>
                <?php endif; ?>

    slideshow code:

    <?php if ( has_post_thumbnail() ) echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'slide',
                        array(
                            'alt'	=> trim(strip_tags( $post->post_title )),
                            'title'	=> trim(strip_tags( $post->post_title )),
                        )).'</a>'; ?>
                    <div class="post-category"><?php the_category(' / '); ?></div>

    Hope somebody can help!
    Kaspar
    PS. Our work in progress is here: http://stuttg-arttours.de/ (currently stretching the square thumbnails used in the loop)

Topic Closed

This topic has been closed to new replies.

About this Topic