2012-03-15 51 views
0

下面是我通过我的滑块我的列表项的标记位,我想知道什么包括作为img源,通过职位编辑器的特色图像是作为该滑块的图像带入。使用'精选图片'在WP中的自定义滑块

<li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-1"><a href="#fragment-1"><img src="" alt="" style="display:none;"/><span><?php the_title(); ?><br /><p class="info" style="padding-left:10px;"><?php the_excerpt(); ?></p></span></a></li> 

我也试着将PHP的该位为img src <?phpthe_post_thumbnail('slider_image'); ?>

完整的代码,我有:

<div id="content"> 


<?php if (have_posts()) : ?> 

<!--Your slider code goes here--> 


     <div id="featured" > 
     <ul class="ui-tabs-nav"> 

      <?php while (have_posts()) : the_post(); ?> 

      <li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-1"><a href="#fragment-1"><img src="" alt="" style="display:none;"/><span><?php the_title(); ?><br /><p class="info" style="padding-left:10px;"><?php the_excerpt(); ?></p></span></a></li> 

      <?php endwhile; ?> 

      <li class="ui-tabs-nav-item" id="nav-fragment-2"><a href="#fragment-2"><img src="" alt="" style="display:none;"/><span><?php the_title(); ?><br /><p class="info" style="padding-left:10px;"><?php the_excerpt(); ?></p></span></a></li> 

      <li class="ui-tabs-nav-item" id="nav-fragment-3"><a href="#fragment-3"><img src="" alt="" style="display:none;"/><span><?php the_title(); ?><br /><p class="info" style="padding-left:10px;"><?php the_excerpt(); ?></p></span></a></li> 

      <li class="ui-tabs-nav-item" id="nav-fragment-4"><a href="#fragment-4"><img src="" alt="" style="display:none;"/><span><?php the_title(); ?><br /><p class="info" style="padding-left:10px;"><?php the_excerpt(); ?></p></span></a></li> 
     </ul> 


     <?php while (have_posts()) : the_post(); ?> 

     <!-- First Content --> 
     <div id="fragment-1" class="ui-tabs-panel" style=""> 
      <img src="<?php the_post_thumbnail('slider_image'); ?>" alt="" /> 
      <div class="info" > 
      <h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2> 
      <p><?php the_excerpt(); ?><a href="<?php the_permalink(); ?>" >read more</a></p> 
      </div> 
     </div> 

     <?php endwhile; ?> 

     <!-- Second Content --> 
     <div id="fragment-2" class="ui-tabs-panel ui-tabs-hide" style=""> 
      <img src="<?php the_post_thumbnail('slider_image'); ?>" alt="" /> 
      <div class="info" > 
      <h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2> 
      <p><?php the_excerpt(); ?><a href="<?php the_permalink(); ?>" >read more</a></p> 
      </div> 
     </div> 
     <!-- Third Content --> 
     <div id="fragment-3" class="ui-tabs-panel ui-tabs-hide" style=""> 
      <img src="<?php the_post_thumbnail('slider_image'); ?>" alt="" /> 
      <div class="info" > 
      <h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2> 
      <p><?php the_excerpt(); ?><a href="<?php the_permalink(); ?>" >read more</a></p> 
      </div> 
     </div> 
     <!-- Fourth Content --> 
     <div id="fragment-4" class="ui-tabs-panel ui-tabs-hide" style=""> 
      <img src="<?php the_post_thumbnail('slider_image'); ?>" alt="" /> 
      <div class="info" > 
      <h2><a href="<?php the_permalink(); ?>" ><?php the_excerpt(); ?></a></h2> 
      <p><?php the_excerpt(); ?><a href="<?php the_permalink(); ?>" >read more</a></p> 
      </div> 
     </div> 
    </div> 

<!--Your slider code goes here--> 
<!-- End Featured Lists Image Slider -->   

<?php endif; ?> 

可能更深度:http://www.sitepoint.com/forums/showthread.php?840162-Help-with-Theming-my-jQuery-CSS-slider-in-WP-to-Dashboard!!&p=5084697#post5084697

但没有这样的运气,有什么建议?

+0

nada获得答案吗? – 2012-03-15 17:10:33

回答

0

首先,the_post_thumbnail没有像'slider_image'那样定义的大小。你可以使用'完整','大','中等'和'缩略图',除了你可以使用不同分辨率的数组(宽度,高度)。

其次,我认为你是通过使用“slider_image”引用一个'自定义字段',你不能通过the_post_thumbnail()函数获取。

您的帖子是否有名为“slider_image”的自定义字段?如果是这样,你可以通过使用解释here

+0

add_image_size('slider_image',940,340,true);这里添加缩略图的大小,好吧..应该提到。第二个问题是:您的帖子是否定义了精选图片? – 2012-03-16 00:15:09