문제

I have a wordpress (v. 3.8) loop that shows 5 future posts:

<?php 
$temp = $wp_query; 
$wp_query = null; 
$wp_query = new WP_Query(); 
$wp_query->query('showposts=5&post_type=events&post_status=future&orderby=date&order=ASC'.'&paged='.$paged); 

while ($wp_query->have_posts()) : $wp_query->the_post(); 
?>

The posts (custom post type "events") are sorting with the "planed" date but i want the newest created post to be on top.

도움이 되었습니까?

해결책

One of the best feature that every WP programmer should know is the ability to schedule his posts in WordPress. This feature can do more then letting you schedule your post to publish at a certain time.

BUT: there is one caveat using the future posts display - there is no valid DATE field to sort on as the date for those future posts is not yet SET.

You could try however with orderby=ID / orderby=modified and order=ASC (of course, assuming the sequence in your future posts by ID is the same sequence as their future dates).

다른 팁

orderby=ID

Did the job. The only question is: when i re-plan a post, how can i move it to top?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top