下载此文档

wordpress添加“归档”页面.doc


文档分类:IT计算机 | 页数:约6页 举报非法文档有奖
1/6
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/6 下载此文档
文档列表 文档介绍
该【wordpress添加“归档”页面 】是由【泰山小桥流水】上传分享,文档一共【6】页,该文档可以免费在线阅读,需要了解更多关于【wordpress添加“归档”页面 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。wordpress添加“归档”页面wordpress“归档”页面,特点:。。。效果:见我网站的存档页下面是详细步骤 :123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141classhacklog_archives{functionGetPosts(){global$wpdb;if($posts=wp_cache_get('posts','ihacklog-clean-archives'))return$posts;$query="SELECTDISTINCTID,post_date,ment_status,post_passwordFROM$wpdb->postsWHEREpost_type='post'ANDpost_status='publish'ANDcomment_status='open'"; $rawposts=$wpdb->get_results($query,OBJECT);foreach($rawpostsas$key=>$post){$posts[mysql2date('',$post->post_date)][]=$post;$rawposts[$key]=null;}$rawposts=null;wp_cache_set('posts',$posts,'ihacklog-clean-archives');;return$posts;}functionPostList($atts=array()){global$wp_locale;global$hacklog_clean_archives_config;$atts=shortcode_atts(array('usejs'=>$hacklog_clean_archives_config['usejs'],'monthorder'=>$hacklog_clean_archives_config['monthorder'],'postorder'=>$hacklog_clean_archives_config['postorder'],'postcount'=>'1','commentcount'=>'1',),$atts);$atts=array_merge(array('usejs'=>1,'monthorder'=>'new','postorder'=>'new'),$atts);$posts=$this->GetPosts();('new'==$atts['monthorder'])?krsort($posts):ksort($posts);foreach($postsas$key=>$month){$sorter=array();foreach($monthas$post)$sorter[]=$post->post_date_gmt;$sortorder=('new'==$atts['postorder'])?SORT_DESC:SORT_ASC;array_multisort($sorter,$sortorder,$month);$posts[$key]=$month; unset($month);$html='</pre><divclass="car-container'; if(1==$atts['usejs'])$html.='car-collapse'; $html.='">'."\n";if(1==$atts['usejs'])$html.='<aclass="car-toggler"href="#"> 展开所有月份}'."</a>\n\n";$html.='<ulclass="car-list"><ulclass="car-list">'."\n";</ul></ul><ulclass="car-list"><ulclass="car-list">$firstmonth=TRUE;</ul></ul><ulclass="car-list"><ulclass="car-list">foreach($postsas$yearmonth=>$posts){</ul></ul><ulclass="car-list"><ulclass="car-list">list($year,$month)=explode('.',$yearmonth);</ul></ul><ulclass="car-list"><ulclass="car-list">$firstpost=TRUE;</ul></ul><ulclass="car-list"><ulclass="car-list">foreach($postsas$post){</ul></ul><ulclass="car-list"><ulclass="car-list">if(TRUE==$firstpost){</ul></ul><ulclass="car-list"><ulclass="car-list"><ulclass="car-list">$html.='</ul></ul></ul><ulclass="car-list"><ulclass="car-list"><li><spanclass="car-yearmonth">+'.sprintf(__('%1$s%2$d'),$wp_locale->get_month($month),$year);if('0'!=$atts['postcount']){$html.='<spantitle="文章数量">(共'.count($posts).'篇文章)</span>';}$html.="</span>\n<ulclass="car-monthlisting"><ulclass="car-monthlisting">\n";</ul></ul><ulclass="car-monthlisting"><ulclass="car-monthlisting">$firstpost=FALSE;</ul></ul><ulclass="car-monthlisting"><ulclass="car-monthlisting">}</ul></ul><ulclass="car-monthlisting"><ulclass="car-monthlisting"><ulclass="car-monthlisting">$html.='</ul></ul></ul><ulclass="car-monthlisting"><ulclass="car-monthlisting"><li>'.mysql2date('d',$post->post_date).' 日:<ahref="'.get_permalink($post->ID).'"target="_blank">'.get_the_title($post->ID).'</a>';if('0'!=$atts['commentcount']&&(0!=$post-&ment_count||'closed'!=$post-&ment_status)&&empty($post->post_password))$html.='<spantitle=" 评论数量">('.$post-&ment_count.' 条评论)</span>';$html.="</li></ul></ul><ulclass="car-monthlisting"><ulclass="car-monthlisting">\n";</ul></ul><ulclass="car-monthlisting"><ulclass="car-monthlisting">}</ul></ul><ulclass="car-monthlisting">$html.="</ul>\n</li></ul></ul><ulclass="car-list"><ulclass="car-list">\n";</ul></ul><ulclass="car-list"><ulclass="car-list">}</ul></ul><ulclass="car-list">$html.="</ul>\n</div><pre>\n";return$html;}functionPostCount(){$num_posts=wp_count_posts('post');returnnumber_format_i18n($num_posts->publish);}}if(!empty($post->post_content)){$all_config=explode(';',$post->post_content);foreach($all_configas$item){ $temp=explode('=',$item);$hacklog_clean_archives_config[trim($temp[0])]=htmlspecialchars(strip_tags(trim($temp[1])));}}else{$hacklog_clean_archives_config=array('usejs'=>1,'monthorder'=>'new','postorder'=>'new');}$hacklog_archives=newhacklog_archives();

wordpress添加“归档”页面 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息