return $r; } /** * @param int $page 页数 * @param int $pagesize 每页显示数量 * @return mixed */ function link_find($page = 1, $pagesize = 100) { $arr = link__find($cond = array(), array('rank' => -1), $page, $pagesize); return $arr; } /** * @param $id * @return bool 返回FALSE失败 TRUE成功 */ function link_delete($id) { if (empty($id)) return FALSE; $r = link__delete(array('id' => $id)); link_delete_cache(); return $r; } //--------------------------kv + cache-------------------------- /** * @return mixed 返回全部友情链接 */ function link_get($page = 1, $pagesize = 100) { $g_link = website_get('friends_link'); if (empty($g_link)) { $g_link = link_find($page, $pagesize); $g_link AND website_set('friends_link', $g_link); } return $g_link; } // delete kv and cache function link_delete_cache() { website_set('friends_link', ''); return TRUE; } ?>custom thumbnail image size not working
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

custom thumbnail image size not working

programmeradmin2浏览0评论
  1. I added below code in theme's function.php

add_theme_support( 'post-thumbnails' );
add_image_size( 'thumb-small', 200, 150, true );

and <?php the_post_thumbnail('thumb-small'); ?> this in theme's file.

  1. I tried this also in function.php

function add_custom_sizes() {
add_image_size( 'idea-thumb', 146, 141, true ); }

add_action('after_setup_theme','add_custom_sizes');

<?php the_post_thumbnail('idea-thumb'); ?> this in theme's file.

  1. the_post_thumbnail( array(100, 100) ); // Other resolutions

But above three condition are not working.

<?php the_post_thumbnail('thumbnail'); ?> //this is working with 150 * 150px as default size.

what i had done mistake.

  1. I added below code in theme's function.php

add_theme_support( 'post-thumbnails' );
add_image_size( 'thumb-small', 200, 150, true );

and <?php the_post_thumbnail('thumb-small'); ?> this in theme's file.

  1. I tried this also in function.php

function add_custom_sizes() {
add_image_size( 'idea-thumb', 146, 141, true ); }

add_action('after_setup_theme','add_custom_sizes');

<?php the_post_thumbnail('idea-thumb'); ?> this in theme's file.

  1. the_post_thumbnail( array(100, 100) ); // Other resolutions

But above three condition are not working.

<?php the_post_thumbnail('thumbnail'); ?> //this is working with 150 * 150px as default size.

what i had done mistake.

Share Improve this question edited Nov 8, 2014 at 9:14 Prashant Tapase asked Nov 8, 2014 at 8:22 Prashant TapasePrashant Tapase 1491 silver badge9 bronze badges 1
  • 2 old existing images will not resize automatically with newly defined image size. You will have to regenerate them again. Use Regenerate Thumbnails plugin to generate thumbnails of all defined sizes. – Robert hue Commented Nov 8, 2014 at 8:35
Add a comment  | 

1 Answer 1

Reset to default 1

I Used Regenerate Thumbnails plugin to generate thumbnails

发布评论

评论列表(0)

  1. 暂无评论