写了一个侧边栏包含缩略图,文章标题,文章摘要,发布日期的最近发布模块,但是觉得过于拥挤,准备去掉摘要,添加序列号,先保存备查。
<?php if (!empty($this->options->augSideBar) && in_array('showRecentPosts', $this->options->augSideBar)): ?>
<section id="widget-post" class="widget-post">
<?php if ($this->options->augSideBarIcon=="true"): ?>
<div class="widget-head widget-head-hasicon"><h4>最近发布</h4><i class="icon-clock2" aria-hidden="true"></i></div>
<?php else: ?>
<div class="widget-head widget-head-noicon"><h4>最近发布</h4></div>
<?php endif;?>
<div class="widget-body">
<ul class="widget-post-list">
<?php $this->widget('Widget_Contents_Post_Recent','pageSize=5')->to($recent); ?>
<?php $recentCount= 1; ?>
<?php while ($recent->next()): ?>
<li class="widget-post-item">
<span class="widget-post-count"><?php echo $recentCount; ?></span>
<?php $recentCount++; ?>
<div class="widget-post-img">
<?php if ($recent->fields->augPostThumb):?>
<img src="<?php echo explode("||" , $recent->fields->augPostThumb)[0]; ?>" alt="<?php echo explode("||" , $recent->fields->augPostThumb)[1]; ?>">
<?php else:?>
<img src="<?php $recent->options->themeUrl('thumbs/'.$recent->options->postListDefaultThumb);?>" alt="<?php echo explode("." , $recent->options->postListDefaultThumb)[0]; ?>">
<?php endif;?>
</div>
<div class="widget-post-info">
<h4 class="widget-post-title"><a href="<?php $recent->permalink() ?>" title="<?php $recent->title() ?>"><?php $recent->title() ?></a></h4>
<p class="widget-post-excerpt"><?php $recent->excerpt(36, '…'); ?></p>
<span class="widget-post-date"><?php $recent->date('Y-m-d'); ?></span>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
</section>
<?php endif; ?>