下面是我通过滑块为"列表"项设置的标记,我想知道要包含什么作为img源,以便通过后编辑器将特色图像作为滑块的图像引入。
<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>
我还尝试过为img src <?phpthe_post_thumbnail('slider_image'); ?>
插入这段PHP
我拥有的完整代码:
<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-帮助主题我的jQuery CSS滑块在WP到仪表板&p=5084697#post5084697
但没有这样的运气,有什么建议吗
首先,_post_thumbnail没有像"slider_image"那样定义大小。你可以使用"full"、"large"、"medium"answers"thumbia",但你可以使用数组(宽度、高度)来获得不同的分辨率。
其次,我认为您使用"slider_image"引用了一个"自定义字段",这是_post_thumbnail()函数无法获得的。
你的帖子有一个名为"slider_image"的自定义字段吗?如果是这样的话,您可以使用这里解释的方法来获得它们。