Proximos Eventos 제목에 www.colegiodepsicologos.org.gt가 있습니다. 게시물 유형 "eventos"의 향후 게시물을 표시하지만, 클릭하면 찾을 수 없는데 어떻게 바꿀 수 있습니까? behaivor 싱글에 미래의 게시물을 표시하려면?미래의 단일 게시물이 표시되지 않음
감사합니다.
Proximos Eventos 제목에 www.colegiodepsicologos.org.gt가 있습니다. 게시물 유형 "eventos"의 향후 게시물을 표시하지만, 클릭하면 찾을 수 없는데 어떻게 바꿀 수 있습니까? behaivor 싱글에 미래의 게시물을 표시하려면?미래의 단일 게시물이 표시되지 않음
감사합니다.
완료!
add_filter(‘the_posts’, ‘show_future_posts’);
function show_future_posts($posts){
global $wp_query, $wpdb;
if(is_single() && $wp_query->post_count ==0){
$posts = $wpdb->get_results($wp_query->request);
}
return $posts;
};
주의 : Jepser 의 답변에는 휴지통/삭제 된 게시물도 표시되며,이 게시물은 표시하고 싶지 않을 수 있습니다.
이것은 단지 (WP 3.9.2에서 테스트) 미래의 게시물로 제한됩니다 :이 또한 휴지통 보여 것
add_filter('the_posts', 'show_future_posts');
function show_future_posts($posts)
{
global $wp_query, $wpdb;
if(is_single() && empty($posts)) //detect cases where WP usually shows 404
{
$posts = $wpdb->get_results($wp_query->request);
//make sure it only affects future posts, not trashed
if(isset($posts[0]->post_status)&&$posts[0]->post_status!='future'){
$posts=array();
}
}
return $posts;
}
하는 것으로 글, 당신은 아마 싶지 않아. 향후 다른 게시물로만이를 제한하려면 내 다른 답변을 참조하십시오. http://stackoverflow.com/a/25941543/1020126 – guidod