在WordPress中,可以通过orderby
进行排序,orderby
支持的排序方法有:
- 按发布日期排序 orderby=date
- 按修改时间排序 orderby=modified
- 按文章 ID 排序 orderby=ID
- 按评论最多排序 orderby=comment_count
- 按标题排序 orderby=title
- 随机排序 orderby=rand
所以为了让文章可以按照修改时间进行排序,首先打开widgets/widget-posts.php
文件,然后修改:
1 2 3 4 5 6 7 8 9 |
<label> 排序: <select style="width:100%;" id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>" style="width:100%;"> <option value="comment_count" <?php selected('comment_count', $instance['orderby']); ?>>评论数</option> <option value="views" <?php selected('views', $instance['orderby']); ?>>浏览量</option> <option value="date" <?php selected('date', $instance['orderby']); ?>>更新时间</option> <option value="rand" <?php selected('rand', $instance['orderby']); ?>>随机</option> </select> </label> |
将第6行的date
改为modified
,然后修改:
1 |
<li><a<?php echo _post_target_blank() ?> href="<?php the_permalink(); ?>"><?php if( $img ){echo '<span class="thumbnail">'; echo _get_post_thumbnail(); echo '</span>'; }else{$img = '';} ?><span class="text"><?php the_title(); ?><?php echo get_the_subtitle() ?></span><span class="muted"><?php the_time('Y-m-d');?></span><?php if( $comn ){ ?><span class="muted"><?php echo '评论(', comments_number('0', '1', '%'), ')'; ?></span><?php } ?></a></li> |
将其中的the_time('Y-m-d');
修改为the_modified_date();
效果如下:
本文最后更新于2019年11月11日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
试试看看行不行
非常好
能否给个联系方式,交流一下请教一下
我感觉我解决了这个Netframework的问题了,安装好要求重启,重启以后安装deepl,但是又出问题了,显示there was an error while installing the appl
请您详细教我一下,怎么下载安装您说的这个.NET
又来麻烦您了,我下载好了,安装的时候提示:Failed to install the .NET Framework, try installing the latest version manuall
win7旗舰版
感谢回复。不是直接点就能安装啊,下载下来的是个压缩文件,解压后有6个内容:.background、.HFS+Private Directory Data、[HFS+Private Data]、Deep