junichi icon indicating copy to clipboard operation
junichi copied to clipboard

归档页面有小问题

Open tlerbao opened this issue 7 years ago • 3 comments

qq 20170314084925

如图,最后有一个

  • 的位置不对,是否是闭合标签不对,我没看代码,望修复。
  • tlerbao avatar Mar 14 '17 00:03 tlerbao

    你把page-archives.php第20行 if ($mon != $mon_tmp && $mon > 0) $output .= '';

    改成 if ($mon != $mon_tmp && $mon > 0) $output .= '';

    试试,看你博客,是那条记录给排除在ul外面导致的,我使用过程中未发现过这个问题。

    siseboy avatar Jun 14 '17 06:06 siseboy

    当前版本主题的page-archives.php中归档逻辑有一点问题。

    Bug复现

    并列的两篇文章拥有不同的年份、相同的月份时,Bug复现,不同年月的两篇文章归档在同一栏目下。 如图:

    解决

    @tlerbao 请将page-archives.php文件替换为以下代码:

    <?php
        /**
        * archives
        *
        * @package custom
        */
        $this->need('header.php'); ?>
    
    	<div class="mid-col">
    		<div class="mid-col-container">
    				<article class="post post-archives">
    					<h1 class="title"><?php $this->title() ?></h1>
    					<div class="entry-content">				
    						<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);
    								$year=0; $mon=0; $i=0; $j=0;
    								while($archives->next()):
    								$year_tmp = date('Y',$archives->created);
    								$mon_tmp = date('m',$archives->created);
    								$y=$year; $m=$mon;
    								if ($mon != $mon_tmp && $mon > 0) $output .= '</ul>';
    								if ($year != $year_tmp && $year > 0) $output .= '</ul>';
    								if ($year != $year_tmp) {
    								$year = $year_tmp;
    								}
    								if ($mon != $mon_tmp || ($mon == $mon_tmp && $y != $year_tmp)) {
    								$mon = $mon_tmp;
    								$output .= '<h3>'. $year_tmp .' 年'. $mon_tmp .' 月</h3>';
    								$output .= '<ul>';
    								}
    								$output .= '<li><a href="'.$archives->permalink .'">'. $archives->title .'</a>&nbsp;&nbsp;&nbsp;&nbsp;('.date('M j, Y',$archives->created).')</li>';
    								endwhile;
    								$output .= '</ul>';
    								echo $output;
    						?>
    					
    					</div>
    				</article>
    		</div>
    
    <?php $this->need('footer.php'); ?>
    

    MortyFx avatar Jul 13 '17 05:07 MortyFx

    @FaithPatrick 感谢提供的帮助,一会儿更新。

    siseboy avatar Jul 13 '17 05:07 siseboy