2013-10-08 1 views
1

내 주제에 이것을 구현하는 데 어려움을 겪고 있습니다. 지금은 테마가 최근 게시물 만 표시합니다. 최근 게시물이나 페이지를 표시하는 방법을 알고 있지만 둘 다 표시하는 방법을 모르겠습니다.wordpress 최근 업데이트 된 페이지 및 게시물을 표시하는 방법

$args = array('post_type' => array('post','page'), 
       'posts_per_page' => $nr_posts, 
       'order'   => 'DESC', 
       'orderby'  => 'date', 
       'post_status' => 'publish' 
      ); 

으로

$nr_posts = ($sd_data['home_sidebar_hide'] == 1) ? $sd_data['home_news_posts_disabled'] : $sd_data['home_news_posts'] ; 
$i = 0; 
$args = array('post_type' => 'post', 
       'posts_per_page' => $nr_posts, 
       'order'   => 'DESC', 
       'orderby'  => 'date', 
       'post_status' => 'publish' 
      ); 
query_posts($args); 
if(have_posts()) : while (have_posts()) : the_post(); $i++; 
$margin_nr = ($sd_data['home_sidebar_hide'] == 1) ? 5 : 4; 
if($i == 1) { 
$class = 'span3 alpha'; 
} else if($i == $margin_nr) { 
$i = 0; 
$i++; 
$class = 'span3 alpha'; 
} else $class = 'span3'; 

?> 
<div class="<?php echo $class; ?>"> 
<div class="news-item"> 
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) : ?> 
<?php the_post_thumbnail('recent-blog'); ?> 
<?php endif; ?> 
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> 
<?php the_title(); ?> 
</a></h3> 
<p><?php echo substr(get_the_excerpt(), 0, 50); ?>...</p> 
<div class="news-meta clearfix"> <span class="news-date"> 
<?php the_time(get_option('date_format')); ?> 
</span> <span class="news-comments"> 
<?php comments_popup_link('0', '1', '%', 'comments-link', 'c'); ?> 
</span> <span class="news-rating"><?php echo sd_post_like_link(get_the_ID()); ?></span>   </div> 
</div> 
</div> 
<?php endwhile; wp_reset_query(); endif; ?> 

답변

1

변경

$args = array('post_type' => 'post', 
       'posts_per_page' => $nr_posts, 
       'order'   => 'DESC', 
       'orderby'  => 'date', 
       'post_status' => 'publish' 
      ); 

WP QUERY

+0

당신을 감사합니다 더 여기를 참조하십시오

여기 전류 루프 코드입니다! 그게 정확 하 게 내가 foor 찾고 무엇입니까! –

+0

응원! 먼저 워드 프레스 코덱스를 추천하는 것을 잊지 마십시오. – codepixlabs

관련 문제