之前很懒,用插件实现存档页面,现在改版主题后,尝试使用添加模版文件去添加存档页面。 大家可以看看我的存档页面。 代码很简单,参考威言威语的页面模版。 首先在主题 functions.php 添加如下代码: class hacklog_archives { function GetPosts() { global $wpdb; if ( $posts = wp_cache_get( ‘posts’, ‘ihacklog-clean-archives’ ) ) return $posts; $query=”SELECT DISTINCT ID,post_date,post_date_gmt,comment_count,comment_status,post_password FROM $wpdb->posts WHERE post_type=’post’ AND post_status = ‘publish’ AND comment_status = ‘open’”; $rawposts =$wpdb->get_results( $query, OBJECT ); foreach( $rawposts as $key => $post ) { $posts[ mysql2date( …
-
拿福能
-
近期文章
-
近期评论
- kitten0 发表在《百度网盘邀请码》
- jiechic 发表在《DD-wrt+IPv6网络配置 over wall 密码见上篇》
- 王小白 发表在《DD-wrt+IPv6网络配置 over wall 密码见上篇》
- 松鼠男 发表在《加班之后》
- jiechic 发表在《加班之后》
-
标签云
-
Friend Links
-
功能