Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从wordpress数据库中获取自定义帖子类型数据,并每季度显示一次_Wordpress - Fatal编程技术网

从wordpress数据库中获取自定义帖子类型数据,并每季度显示一次

从wordpress数据库中获取自定义帖子类型数据,并每季度显示一次,wordpress,Wordpress,我在这里有两个场景显示基于每月的数据 喜欢 2020年1月 -数据1数据1日期 -数据2数据2日期 2020年2月 -数据3数据3日期 -数据4数据4日期 =============================================================================================== 第二种情况需要每季度获取一次数据 喜欢 2020年1月至3月 -数据1数据1日期 -数据2数据2日期 2020年4月至6月 数据3数据3日期 数据4数

我在这里有两个场景显示基于每月的数据 喜欢 2020年1月 -数据1数据1日期 -数据2数据2日期 2020年2月 -数据3数据3日期 -数据4数据4日期

===============================================================================================

第二种情况需要每季度获取一次数据 喜欢 2020年1月至3月 -数据1数据1日期 -数据2数据2日期

2020年4月至6月

  • 数据3数据3日期
  • 数据4数据4日期
有人能看一下吗

在这里输入代码


谢谢

这是我用于每月内容的代码

$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>';
        ?>
$ref_month='';
$args=数组(
“发布类型”=>“电子邮件时事通讯”,
“paged'=>获取查询变量('paged')/*,
“每页帖子”=>-1*/
); ?>

您是否有尝试过的mySQL查询示例?您使用什么语言访问数据库?您是否在脚本中尝试过您的场景之一?如果可以,请提供一些代码示例?$args=array('post\u type'=>'email\u newsletter','paged'=>get\u query\u var('paged')/*,'posts\u per\u page'=>-1*/);?>这就是我在WordPress中使用的查询这里是我用于每月内容$ref_month=''的代码$args=array('post\u type'=>'email\u newsletter','paged'=>get\u query\u var('paged')/*,'posts\u per\u page'=>-1*/);?>