2012-09-07 2 views

답변

1

질문을 완전히 이해할 수 있을지 모르겠다. 특정 날짜/요일에 게시 된 특정 카테고리의 게시물 수를 원하십니까?

이 경우 WP_Query의 인스턴스를 만들고 보려는 time parameterscategories을 전달하면됩니다.

뭔가 같은

<?php 
$today = getdate(); 
$args = array('year' => $today["year"], 'monthnum' => $today["mon"], 'day' => $today["mday"], 'category_name' => 'Uncategorized'); 
$search = new WP_Query($args); 
$count = $search->found_posts; 
?> 

당신이 수정 된 날짜를 기준으로 게시물을 반환하려면

가 (당신이 이해가 안 하루에 수를 업데이트 게시물을, 상태), 다음은 'posts_where를 추가해야 '필터 대신 args의 시간 매개 변수를 사용하십시오.

샘플 코드 및 사용 방법에 대한 위의 시간 매개 변수 링크를 참조하십시오. 그러나 예제를 약간 수정하면 이와 비슷한 것을 만들 수 있습니다.

// Create a new filtering function that will add our where clause to the query 
function filter_where($where = '') { 
$where .= " AND post_modified >= '2010-03-01' AND post_modified < '2010-03-16'"; 
return $where; 
} 

add_filter('posts_where', 'filter_where'); 
$query = new WP_Query($query_string); 
remove_filter('posts_where', 'filter_where'); 
+0

도와 주셔서 감사합니다. 내가 찾고있는 것이지만 ... 내 자신의 코드로 해결했습니다. –

관련 문제