Php Flex滑块与WordPress的集成
[已解决] 我正在尝试将flexslider(flexslider.woothemes.com)与WordPress集成。我已经包含了所有需要的JS/CSS文件 然后,我添加了这段代码来显示某个类别的特征图像——著名的WP_查询,其中$args设置为某个类别。然后使用echo_post_缩略图();我正在展示帖子的图片。很好用。我只需要将图片链接到post URL(IMG是hrefed)。请提前提供帮助和感谢Php Flex滑块与WordPress的集成,php,wordpress,flexslider,Php,Wordpress,Flexslider,[已解决] 我正在尝试将flexslider(flexslider.woothemes.com)与WordPress集成。我已经包含了所有需要的JS/CSS文件 然后,我添加了这段代码来显示某个类别的特征图像——著名的WP_查询,其中$args设置为某个类别。然后使用echo_post_缩略图();我正在展示帖子的图片。很好用。我只需要将图片链接到post URL(IMG是hrefed)。请提前提供帮助和感谢 <?php $args = array( 'post_
<?php
$args = array(
'post_type' => 'post',
'category_name' => 'one',
'posts_per_page' => 5
);
// The Query
$the_query = new WP_Query( $args );
// Check if the Query returns any posts
if ( $the_query->have_posts() ) {
// Start the Slider ?>
<div class="flexslider">
<ul class="slides">
<?php
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<?php }
// The Slide's Image
echo the_post_thumbnail();
</li>
<?php endwhile; ?>
</ul><!-- .slides -->
</div><!-- .flexslider -->
<?php
// Reset Post Data
wp_reset_postdata();
?>
-
-
如果我理解你的问题,我想答案是
echo';
您是否试图将您的图像包装到相关帖子的链接中?那部分我理解对了吗?
<?php
$args = array(
'post_type' => 'post',
'category_name' => 'one',
'posts_per_page' => 5
);
// The Query
$the_query = new WP_Query( $args );
// Check if the Query returns any posts
if ( $the_query->have_posts() ) {
// Start the Slider
?>
<div class="flexslider">
<ul class="slides">
<?php
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>">
<?php echo the_post_thumbnail(); ?>
</a>
</li>
<?php endwhile; ?>
</ul><!-- .slides -->
</div><!-- .flexslider -->
<?php }
// Reset Post Data
wp_reset_postdata();
?>