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

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

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

其次 按照下面的替換其中的代碼,從而可以讓主題識別這個歸檔獨立頁面

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'); ?>   
第三 接著按照以下代碼進行替換,其替換的代碼為歸檔的核心代碼

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)建完成,接著上傳到主題目錄,然后進入typecho后臺新建page頁面,然后選擇模板為archives,如果開始創(chuàng)建這個頁面的時候不是取的這個名字請自行選擇!下面分享一個現(xiàn)成的獨立頁面,直接新建一個page.php頁面,代碼全部復(fù)制進去即可!

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">當前位置:<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)文章

最新評論