Question

I've created a filterable portfolio in wordpress followindg a quicksand tutorial I found.

Everything is working but the author did not link the featured image in the page template nor set the thumbnail size for the post type. I want the thumbnail size to be 280px x 180px.

Here is the code: (Edited working code below)

<ul class="portfolio-grid">
        <?php


        $pfportfolio = new WP_Query( 'post_type=portfolio' );


        while ( $pfportfolio->have_posts() ) : $pfportfolio->the_post();?>


        <?php
            echo '<li data-id="post-'.get_the_ID().'" data-type="'.$terms_as_text = strip_tags( get_the_term_list( $post->ID, 'pftype', '', ' ', '' ) ).'">';
            ?>
            <div class="item">
                        <div class="view third-effect">
            <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_post_thumbnail( 'homepage-thumb' ); ?></a>
            <?php

            ?>
            <div class="mask">
                            </div>
            <div class="item-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></div>
            </div>
            </div>
            <?php

            echo '</li>';
        endwhile;

        wp_reset_postdata();
        ?>
    </ul>
Was it helpful?

Solution

You need to register a new image size in your functions file ( see http://codex.wordpress.org/Function_Reference/add_image_size ) then change this line to add the new image size id instead of 'home-feat'.

the_post_thumbnail('home-feat');

(for example, too )

the_post_thumbnail('new-image-size');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top