我的wordpress主题上有这个代码。但我需要做一些改变。
<?php
$args = array( 'post_type' =>'movies','posts_per_page'=>10 ,'post_status'=> 'publish');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$notification_title = get_post_meta( get_the_ID(), 'movies_notifications_meta_title', true );
$notification_subtitle = get_post_meta( get_the_ID(), 'movies_notifications_meta_subtitle', true );
$notification_name = get_post_meta( get_the_ID(), 'movies_notifications_meta_name', true );
$notification_caption = get_post_meta( get_the_ID(), 'movies_notifications_meta_caption', true );
echo '<li><a class="waves-effect" href="';
the_permalink();
echo '">';
the_post_thumbnail();
echo '<span class="notifications-title">';
echo "$notification_title";
echo '</span><br>';
echo '<span class="notifications-subtitle">';
echo "$notification_subtitle";
echo '</span><br>';
echo '<span class="notifications-name">';
echo "$notification_name";
echo '</span>';
echo '<span class="new badge teal accent-4 notific" data-badge-caption="version">';
echo "$notification_caption";
echo '</span>';
echo '<li class="divider"></li>';
echo '</a></li>';
endwhile;
wp_reset_query();
?>
&#13;
我想以修改日期订购此帖子,当我更新此处显示的帖子时,谢谢
答案 0 :(得分:1)
这可以帮到你:
$args = array(
'post_type' =>'movies',
'posts_per_page'=>10 ,
'post_status'=> 'publish',
'orderby'=>'modified'
);
有关可用的orderby参数的更多信息:https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters