【发布时间】:2015-05-03 16:31:31
【问题描述】:
我正在 wordpress 中制作图库,我想更改默认缩略图大小,但它无法正常工作。当我在 wordpress 媒体选项中将照片设置为后缩略图自然大小为 150x150 时,我将缩略图大小更改为 215 143。
在我拥有的功能中
add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1240, 1240 );
}
我的画廊查询:
<ul id="stage">
<?php
// The Query
$the_query = new WP_Query( array( 'post_type' => 'flota', 'orderby' => 'title', 'order' => 'ASC' ) );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id ( $the_query->ID ), 'thumbnail' );
$full = wp_get_attachment_image_src( get_post_thumbnail_id ( $the_query->ID ), 'full' );
$cats = wp_get_object_terms( $post->ID, 'flota_category' );
$items = array();
foreach ( $cats as $cat ){
$slug = $cat->slug;
$items[] = $slug;
}
$counter = count($cats);
$i = 0;
?>
<li data-tags="<?php
foreach ( $items as $tag ){
if (++$i === $counter ){
$tags = $tag;
}
else{
$tags = $tag . ', ';
}
echo $tags;
}
?>"><a href="<?php echo $full[0] ?>" rel="lightbox[flota]"><img src="<?php echo $thumbnail[0] ?>" width="215" height="143" style="background:#ffffff;"></a></li>
<?php
endwhile;
?>
</ul>
【问题讨论】:
标签: php wordpress thumbnails