ワードプレス
サムネイルサイズ指定
functions.php
add_theme_support( 'post-thumbnails' ); add_image_size('size1',340,240,true); add_image_size('size2',600,284,true);
templete
<?php if(get_post_meta($post->ID, 'service_pic01', true)): ?> <?php $image_cons01 = wp_get_attachment_image_src( get_post_meta($post->ID,'service_pic01', true),'size2' ); ?> <img src="<?php echo $image_cons01[0]; ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" > <?php else : ?> <img src="<?php echo get_template_directory_uri() ?>/img/common/service.png" alt="<?php the_title(); ?>" /> <?php endif ; ?>