如何为此滑块进行循环: 我的滑块看起来像是:http://www.awesomescreenshot.com/image/969867/a3a51b333881ca762739151dae8b16f9
第一个li由顶部图像组成,第二个由下面一个组成。每张图片必须是一个帖子
Html代码:
<div class="row cycle-slideshow" data-cycle-fx=carousel data-cycle-timeout=0 data-cycle-carousel-visible=3 data-cycle-carousel-fluid=true data-cycle-slides="li" data-cycle-next="#next" data-cycle-prev="#prev" data-cycle-pager="#pager">
<ul>
<li class="span2">
<a href="#journeymodel">
<img src="http://lorempixel.com/200/200/">
<h3>Barobudur Temple, java</h3>
<div></div>
</a>
<a href="#journeymodel">
<img src="http://lorempixel.com/200/200/">
<h3>Barobudur Temple, java</h3>
<div></div>
</a>
</li>
<li class="span2">
<a href="#journeymodel">
<img src="http://lorempixel.com/200/200/">
<h3>Uluvatu Temple, Bali</h3>
<div></div>
</a>
<a href="#journeymodel">
<img src="http://lorempixel.com/200/200/">
<h3>Uluvatu Temple, Bali</h3>
<div></div>
</a>
</li>
Php代码:
<?php
$loop = new WP_Query(array('post_type'=>'realisation','sort_column' => 'post_date','posts_per_page'=> -1);//'order' => 'DESC');
if ( $loop->have_posts() )
{
while ( $loop->have_posts() )
{
$loop->the_post();
$cat=get_post_meta($post->ID,'category',true);
if ($cat=='privae') // post catagory
{
//li section should comes here by based on list of post added
有人可以指导我如何更新此部分的循环。
答案 0 :(得分:0)
您可以这样做:
$arr = array("post_type" => "post_type", 'posts_per_page' => -1, 'orderby' => 'post_title', 'order' => 'ASC');
$posts= get_posts($arr);
echo '<ul>';
foreach($posts as $post) {
$img= get_post_meta($post->ID, 'meta_field', true);
echo "<li><img src='" . $img . "' /></li>";
}
echo '</ul>';