2012-04-18 105 views
0

我使用這個對我的wordpress顯示圖像blog-php&wordpress - 顯示完整圖像而不是縮略圖?

功能:

add_theme_support('post-thumbnails'); 
set_post_thumbnail_size(590, 275, true); // 590 pixels wide by 275 pixels tall, hard crop mode 

指數:

<div class="post-wrap"> 
     <?php the_post_thumbnail(); ?> 
     <?php the_excerpt(__('keep reading', 'grisaille')); ?></div> 
     <?php wp_link_pages(
       array( 'before'   => '<p class="pages-links">' . __('Pages:', 'grisaille'), 
         'after'   => '</p>', 
         'next_or_number' => 'number', 
         'nextpagelink'  => __('Next page', 'grisaille'), 
         'previouspagelink' => __('Previous page', 'grisaille'), 
         'pagelink'   => '%')); ?> 
     <p class="postMeta"><small><?php _e('Category', 'grisaille'); ?> <?php the_category(', ') ?> | <?php _e('Tags', 'grisaille'); ?>: <?php the_tags(' '); ?></small></p> 

     <hr class="noCss" /> 
    </li> 

    <?php comments_template(); // Get wp-comments.php template ?> 

    <?php endwhile; ?> 

而不是顯示縮略圖時,我想顯示完整圖像。我該如何做到這一點?

+1

這是wordpress,不是PHP! – 2012-04-18 13:22:36

+2

它仍然是PHP。 – Michelle 2012-04-18 13:24:48

+1

@YourCommonSense WordPress的沒有它的唯一代碼,它仍然是PHP .. – AMC 2012-04-18 13:27:34

回答

1

替換此:

<?php the_post_thumbnail(); ?> 

...這一點:

<?php the_post_thumbnail('full'); ?> 
+0

完美,謝謝! – AMC 2012-04-18 15:20:36

1

使用此功能:

wp_get_attachment_image(get_post_thumbnail_id(get_post(get_the_ID()),'full',0,array('title' => '')); 

Check this link

+0

這似乎是我正在尋找,但在什麼情況下我使用它?我用'<?php the_post_thumbnail()>替代了你給的函數。 ''''也使用了codex中給出的例子,但它似乎並沒有工作.. – AMC 2012-04-18 13:40:13

+0

哦對不起,函數'get_page_by_title'不會做的東西。請檢查編輯 – 2012-04-18 13:53:09

+0

檢查並告訴我它是否無效。當我在什麼情況下使用時間 – 2012-04-18 13:54:44

0

有內置的四個有效尺寸到W ordPress核心。

the_post_thumbnail('thumbnail');  // Thumbnail (default 150px x 150px max) 
the_post_thumbnail('medium');   // Medium resolution (default 300px x 300px max) 
the_post_thumbnail('large');   // Large resolution (default 640px x 640px max) 
the_post_thumbnail('full');   // Original image resolution (unmodified) 

最後一個是你正在尋找的。