2010-01-27 3 views
0

나는 '제품'은워드 프레스 사용자 정의 페이지 템플릿

<?php 
/* 
Template Name: Products 
*/ 
?> 
<?php get_header(); ?> 

<div id="products_content"> 
    <div id="products_page_header"> 
    <div id="products_page" title="محصولات"> 
     <?php if (have_posts()) : while (have_posts()) : the_post();?> 
     <div class="post"> 
     <h2 id="post-<?php the_ID(); ?>"> 
      <?php the_title();?> 
     </h2> 
     <div class="entrytext"> 
      <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?> 
     </div> 
     </div> 
     <?php endwhile; endif; ?> 
    </div> 
    </div> 
</div> 
<div id="clear"> </div> 
<?php get_sidebar(); ?> 
<?php get_footer(); ?> 
</div> 
</body></html> 

하지만 내 게시물을 보여 나던, 어떻게 내가 잘못하고있는 중이라는 이름의 사용자 정의 페이지를 만들었습니다?

표준 워드 프레스 루프를 들어

답변

2

해야한다 다른 코드를 사용해야합니다 :

<?php 
/* 
Template Name: Products 
*/ 
?> 
<?php get_header(); ?> 

<div id="products_content"> 
    <div id="products_page_header"> 
    <div id="products_page" title="محصولات"> 
     <?php $query = new WP_Query('showposts=10'.'&paged='.$paged); ?> 
      <?php if ($query->have_posts()) : ?> 
     <?php while ($query->have_posts()) : $query->the_post(); ?> 
     <div class="post"> 
     <h2 id="post-<?php the_ID(); ?>"> 
      <?php the_title();?> 
     </h2> 
     <div class="entrytext"> 
      <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?> 
     </div> 
     </div> 
     <?php endwhile; endif; ?> 
    </div> 
    </div> 
</div> 
<div id="clear"> </div> 
<?php get_sidebar(); ?> 
<?php get_footer(); ?> 
</div> 
</body></html> 
0

<?php endwhile; endif; ?>는 모든 게시물을 표시하기 위해, 블로그 페이지처럼 게시물이 코드는 "제품"페이지의 내용을 보여줍니다이 코드 doenst

<?php endwhile; ?> 
<?php else : ?> 

(optional: Sorry, but you are looking for something that isn't here.) 

<?php endif; ?> 

<?php get_sidebar(); ?> 
<?php get_footer();?> 
+0

주목할 것! 그것은 어떤 게시를 보여주지 않을 것이다! – datisdesign

관련 문제