2013-02-15 114 views
0

這是我function.phpwordpress 3.5.1精選圖片沒有顯示...?

<?php if (function_exists('add_theme_support')){ add_theme_support('post-thumbnails'); }

if (function_exists('add_image_size')){ add_image_size('featured', 400, 340, true); add_image_size('post-thumb', 100, 140, true); } ?>

裏面這是什麼我的index.php裏面

<?php the_post_thumbnail('post-thumb'); ?>

  1. Screen Options特色圖片啓用。
  2. 特色圖片元顯示於Edit Post
  3. 精選圖片已設置。

問題是縮略圖沒有顯示在index.php(主頁)中。我錯過了什麼嗎?非常感謝提前。

回答

0

把下面的代碼放在上面:the_content();

<?php 
    if (has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it. 
    the_post_thumbnail('post-thumb'); 
    } 
?> 

看到它的更多信息:http://codex.wordpress.org/Function_Reference/the_post_thumbnailhttps://wordpress.stackexchange.com/questions/39798/thumbnail-cropping-with-add-image-size

+0

我已經完成這件事,但沒有工作。我不知道我做錯了什麼。 – s4m 2013-02-15 05:55:19

+0

關閉!問題解決了! – s4m 2013-02-15 14:03:06

+0

@ s4m請寫下你是如何解決問題的。 – OnkelK 2013-09-01 09:10:24

0

更換非工作代碼

add_theme_support(‘post-thumbnails’); 

與合作變種:

add_theme_support(‘post-thumbnails’, array(‘post’, ‘page’, ‘player’));