欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Typecho 創(chuàng)建文章歸檔頁面的實(shí)現(xiàn)方法(非插件)

  發(fā)布時(shí)間:2015-08-24 12:44:59   作者:佚名   我要評(píng)論
這個(gè)歸檔相信大家都不陌生,因?yàn)楸救耸窍葟膚ordpress開始的,所以在wp實(shí)現(xiàn)了這個(gè)之后跳到typecho必須也要實(shí)現(xiàn)這個(gè),好在開源什么都可以通過代碼實(shí)現(xiàn),
下面就分享下typecho如何非插件實(shí)現(xiàn)文章歸檔頁面,其實(shí)挺簡單的,按照下面的搞起,分分鐘的事情!
首先 復(fù)制page.php一枚,重命名為archives,當(dāng)然,這個(gè)可以根據(jù)自己的喜好隨便起名

其次 按照下面的替換其中的代碼,從而可以讓主題識(shí)別這個(gè)歸檔獨(dú)立頁面

PHP Code復(fù)制內(nèi)容到剪貼板
  1. <?php $this->need('header.php'); ?>   
替換為

PHP Code復(fù)制內(nèi)容到剪貼板
  1. <?php   
  2.     /**  
  3.     * archives  
  4.     *  
  5.     * @package custom  
  6.     */  
  7.     $this->need('header.php'); ?>   
第三 接著按照以下代碼進(jìn)行替換,其替換的代碼為歸檔的核心代碼

PHP Code復(fù)制內(nèi)容到剪貼板
  1. <?php $this->content(); ?>   
替換為


復(fù)制代碼
代碼如下:

<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->parse('<li>{year}-{month}-{day} : <a href="{permalink}">{title}</a></li>'); ?>


到此歸檔頁面已經(jīng)創(chuàng)建完成,接著上傳到主題目錄,然后進(jìn)入typecho后臺(tái)新建page頁面,然后選擇模板為archives,如果開始創(chuàng)建這個(gè)頁面的時(shí)候不是取的這個(gè)名字請(qǐng)自行選擇!下面分享一個(gè)現(xiàn)成的獨(dú)立頁面,直接新建一個(gè)page.php頁面,代碼全部復(fù)制進(jìn)去即可!

PHP Code復(fù)制內(nèi)容到剪貼板
  1. <?php   
  2. /**  
  3.     * archives  
  4.     *  
  5.     * @package custom  
  6.     */  
  7. $this->need('header.php'); ?>   
  8.     <div id="mainbox2">   
  9.         <div class="position">當(dāng)前位置:<a href="./">首頁</a> » <?php$this->title() ?></div>   
  10.         <div class="post"  id="post-<?php $this->cid(); ?>">   
  11.             <h2><span class="float_l"><a href="<?php $this->permalink() ?>" title=""><?php $this->title() ?></a></span></h2>   
  12.             <div class="clear"></div>   
  13.             <div class="entry">   
  14. <?php $this->widget('Widget_Contents_Post_Recent','pageSize=10000')->parse('<li>{year}-{month}-{day} : <a href="{permalink}">{title}</a></li>'); ?>   
  15.                 <div class="clear"></div>   
  16.             </div>   
  17.         </div>   
  18.     </div><!--mainbox end-->      
  19. <?php $this->need('footer.php'); ?>  

至于樣式如果有不滿意可以自己寫下CSS美化下,既然折騰,就勇猛的向后看齊吧!

相關(guān)文章

最新評(píng)論