Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.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
Php Wordpress存档页面,每月发布一次+;日期_Php_Wordpress_Archive - Fatal编程技术网

Php Wordpress存档页面,每月发布一次+;日期

Php Wordpress存档页面,每月发布一次+;日期,php,wordpress,archive,Php,Wordpress,Archive,我试图在模板中有一个具有特定布局的归档部分 我试图得到如下列表: FEBRUARI 01-02-2011 - Title 3 03-02-2011 - Title 4 JANUARY 01-01-2011 - Title 03-01-2011 - Title 2 < older entries newer entries>` 二月 01-02-2011-标题3 2011年2月3日-标题4 一月 01-01-2011-标题 2011年1月3日-标题2 ` 我试图让我的代

我试图在模板中有一个具有特定布局的归档部分

我试图得到如下列表:

FEBRUARI
01-02-2011 - Title 3
03-02-2011 - Title 4

JANUARY
01-01-2011 - Title
03-01-2011 - Title 2

< older entries     newer entries>`
二月 01-02-2011-标题3 2011年2月3日-标题4 一月 01-01-2011-标题 2011年1月3日-标题2 <较旧的条目较新的条目>` 我试图让我的代码工作,但它失败了,每个月只显示一个帖子

<?php
// List Pages by Month/Day
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'paged' => $paged,
 'post_type' => 'post',
 'posts_per_page' => 10,
             );
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post();
  $this_dt = get_the_time('M',$post->post_date);
  if ($curr_dt != $this_dt) { ?>
<h4><?php echo $this_dt; ?></h4>
  <ul class="artikelen">
  <li><a href="<?php the_permalink(); ?>"><span><?php echo get_the_time('d');?> - <?php echo get_the_time('M');?> | <?php echo get_the_time('Y'); ?> |</span><?php the_title();?></a></li><?php echo "</ul>"; }
 $curr_dt = $this_dt; endwhile; ?>
<div class="navigation">
  <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
  <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
</div>
<?php else :
// Code here for no pages found
endif;
?>


我想知道我做错了什么,或者这是否可能。谢谢

如果循环仅用于显示月份一次,请在显示月份后右键关闭它:

<?php
// List Pages by Month/Day
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'paged' => $paged,
 'post_type' => 'post',
 'posts_per_page' => 10,
             );
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post();
  $this_dt = get_the_time('M',$post->post_date);
  if ($curr_dt != $this_dt) { ?>

<h4><?php echo $this_dt; ?></h4>

   <?php } ?>

  <ul class="artikelen">
  <li><a href="<?php the_permalink(); ?>"><span><?php echo get_the_time('d');?> - <?php echo get_the_time('M');?> | <?php echo get_the_time('Y'); ?> |</span><?php the_title();?></a></li><?php echo "</ul>"; 
 $curr_dt = $this_dt; endwhile; ?>
<div class="navigation">
  <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
  <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
</div>
<?php else :
// Code here for no pages found
endif;
?>


当时我完全忘了回复。这很有魅力,谢谢你的努力!