好的,我有一个客户端,它只想显示当月的帖子。我尝试了几种不同的变体,但都没有成功。这就是我现在的处境。感谢您的帮助!
<?php
$current_year = date(\'Y\');
$current_month = date(\'m\');
$args = array(
\'year\' => $current_year,
\'monthnum\' => $current_month
);
$custom_query = new WP_Query(\'$args\');
if ($custom_query->have_posts()) : while ($custom_query->have_posts()) : $custom_query->the_post();
// The following determines what the post format is and shows the correct file accordingly
$format = get_post_format();
get_template_part( \'includes/post-formats/\'.$format );
if($format == \'\')
get_template_part( \'includes/post-formats/standard\' );
endwhile; else:
?>