我在这里有两个场景,根据数据显示数据,比如2020年1月-数据1数据1日期数据数据2数据2 2020年2月数据3数据3日期数据4数据4日期
===============================================================================================
第二个场景需要按季度获得数据,如2020年1月至3月数据1数据1日期数据2数据2日期。
2020年4月至6月
谁能帮我看看
在这里输入代码
谢谢
发布于 2020-05-18 03:29:46
这是我用于每月内容的代码
$ref_month = '';
$args = array(
'post_type' => 'email_newsletter',
'paged' => get_query_var('paged')/*,
'posts_per_page' => -1*/
); ?>
<?php
$nbemails = new WP_Query($args);
?>
<?php if($nbemails->have_posts()) : ?>
<div class="newsletter-list-container page-container ">
<div class="row">
<div class="small-12 medium-12 column">
<?php while($nbemails->have_posts()) : $nbemails->the_post();
if( get_the_date('mY') != $ref_month ) {
if( $ref_month ) echo "\n".'</ul>';
echo "\n".'<h3 class="heading_H3">'.get_the_date('F Y').'</h3>';
echo "\n".'<ul class="nl-list">';
$ref_month = get_the_date('mY');
}
echo "\n".' <li><a href='.get_permalink($post->ID).'>'.get_the_title($post->ID).' <span class="nl-date">'.get_the_date('F d, Y').'</span></a></li>';
?>
<!-- <a href="<?php the_permalink() ?>"><?php the_title(); ?></a> -->
<?php
endwhile;
echo "\n".'</ul>';
?>
https://stackoverflow.com/questions/61868570
复制