这是我当前检索幻灯片的方式:
<?php
$args = array(
\'ignore_sticky_posts\' => 1,
\'posts_per_page\' => 20,
\'post_type\' => \'slide\'
);
$slides = new WP_Query( $args );
?>
<?php if($slides->post_count > 0) :?>
<div class="slideshow">
<ul class="slides">
<?php $i = 1; while ($slides->have_posts()) : $slides->the_post(); ?>
<?php
//Get slide options
$slide_background_img = wp_get_attachment_image_src(get_post_meta($post->ID, "_ttrust_slide_background_image", true), \'full\');
$slide_background_img = $slide_background_img[0];
$s_styles = "";
$s_class = "";
if($slide_background_img){
$s_styles .= "background-image: url(".$slide_background_img.");";
}
?>
<li id="slide<?php echo $i; ?>" <?php post_class($s_class); ?> style="<?php echo $s_styles;?>">
和在函数中。php我设置了拇指大小:
add_theme_support(\'post-thumbnails\');
add_image_size( \'vip-thumb\', 1024, 9999 ); //300 pixels wide (and unlimited height)
如果在早期代码中,我更改:
$slide_background_img = wp_get_attachment_image_src(get_post_meta($post->ID, "_ttrust_slide_background_image", true), \'full\');
至
$slide_background_img = wp_get_attachment_image_src(get_post_meta($post->ID, "_ttrust_slide_background_image", true), \'vip-thumb\');
或
$slide_background_img = wp_get_attachment_image_src(get_post_meta($post->ID, "_ttrust_slide_background_image", true), \'vip-thumb\', true);
我没有调整大小的拇指,只有原始图像
知道我做错了什么吗?