2011-05-03 81 views
-1

你好 我需要做一个wordpress幻灯片。 我需要循环列出职位为WordPress的幻灯片

  • 这是HTML

    <div id="container"> 
        <div id="content"> 
         <div id="slider"> 
          <ul> 
           <li> 
            <img src="images/slide01.jpg" alt="Css Template Preview" /></li> 
                  <li> 
            <img src="images/slide02.jpg" alt="Css Template Preview" /></li> 
                  <li> 
            <img src="images/slide03.jpg" alt="Css Template Preview" /></li> 
          </ul> 
         </div> 
        </div> 
    </div> 
    

    这是PHP。

    <div id="container"> 
    <div id="content"> 
        <div id="slider"> 
         <?php $query= 'cat=3'; ?> 
         <?php query_posts($query); ?> 
         <?php if(have_posts()) : ?> 
         <?php while(have_posts()) : the_post(); ?> 
         <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 
         <?php the_content(); ?> 
         <?php endwhile; ?> 
         <?php endif; ?> 
        </div> 
    </div> 
    

    +0

    你的问题是什么? – 2011-05-03 07:55:31

    回答

    1

    所以我猜你有各自只含有1图像职位,要列出这些职位的幻灯片?如果是这样,你可以这样做(未经测试的代码):

    <div id="container"> 
    <div id="content"> 
        <div id="slider"> 
         <ul> 
         <?php 
          $query= 'cat=3'; 
          query_posts($query); 
          if(have_posts()) : 
          while(have_posts()) : the_post(); 
         ?> 
         <li><?php the_content(); ?></li> 
         <?php 
          endwhile; 
          endif; 
         ?> 
         </ul> 
        </div> 
    </div>