2011-08-15 5 views
0

나는 워드 프레스에 관해서는 일종의 멍청이입니다; 나는 최근에 테마를 만들기 시작했고 벽에 부딪쳤다. 나는 wpquery를 사용하여 내 사이트의 맨 위에 3 개의 다른 기사를 게재하려고 노력 중이고 일부 이유는 단지 하나만 표시하는 것입니다. 나는 아래에 나의 코드를 포함시킬 것이고 만약 누군가가 내 그림을 잘못 이해한다면 도움이된다면 매우 감사 할 것입니다!Wordpress Query에 대한 도움말

코드 페이스트 빈에 포함 된

<div class="site_width"> 
    <ul> 
    <?php 
    $args = array('tag' => 'featured', 'posts_per_page' => '3'); 
    $recent_posts = wp_get_recent_posts($args); 
    ?> 
    <li> 
     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="nofollow"> 
      <?php the_post_thumbnail('featured', array('title' => '')); ?> 
     </a> 
     <label> 
      <a href="<?php the_permalink(); ?>" rel="bookmark"> 
       <?php the_title(); ?> 
      </a> 
     </label> 
    </li> 
    <?php wp_reset_query(); ?> 
    </ul> 
</div> 

http://pastebin.com/1DB7vent 나는 세 총 2 번 이상 반복 할 수있는 "리"를 원한다. 나는 이것과 비슷한 설정을하려고 노력 중이다 :

<div class="site_width"> 
    <li> 
     <a href="feat.article1.permalink" title="feat.article1.title"> 
     <img src="feat.article1.featured.image"> 
     </a> 
     <label> 
     <a href="feat.article1.permalink" title="feat.article1.title"> 
      "Featured Article 1 Title" 
     </a> 
     </label> 
    </li> 
    <REPEAT 'LI' ABOVE TWICE MORE BELOW> 
</div> 
+0

루프가 어디에 있습니까? 참조 http://stackoverflow.com/questions/3741399/wordpress-query-posts-adding-two-post-entry-divs-one-with-post-thumbnail-and http://stackoverflow.com/ 질문/5382905/wordpress-query-posts-how-to-show-multiple-posts –

답변

1

loop.php의 현재 테마 디렉토리를 살펴 보자. 조회 결과를 반복하여 표시해야합니다. 일반적인 구조는 다음과 같습니다.

<?php while (have_posts()) : the_post(); ?> 
    <li> 
     <?php //show your post ?> 
    </li> 
<?php endwhile; // End the loop. Whew. ?>