0

我在 wordpress 中创建了一个可过滤的投资组合,遵循我找到的流沙教程。

一切正常,但作者没有在页面模板中链接特色图片,也没有为帖子类型设置缩略图大小。我希望缩略图大小为280px x 180px.

这是代码:(下面编辑了工作代码)

<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>
4

1 回答 1

0

您需要在函数文件中注册一个新的图像大小(请参阅http://codex.wordpress.org/Function_Reference/add_image_size),然后更改此行以添加新的图像大小 ID 而不是“home-feat”。

the_post_thumbnail('home-feat');

(例如,太)

the_post_thumbnail('new-image-size');
于 2014-01-25T18:55:19.177 回答