海豚的WordPress Theme教程 part4

  这回讲index.php,从这篇开始我不帖相关的css内容了,因为详细解释css内容就变成css教程了,而事实上我自己都没怎么搞清楚css,一般都是边改边学。需要相关css的可以直接去下载KD02模版,自己慢慢研究。

index.php
[php]

” rel=”bookmark” title=”Permanent Link to “>

@

| |‘); ?>

Not found.

[/php]

  • line1, line43, line45: 负责把header.php, sidebar.php, footer.php的内容引入,这样这几部分就作为一个整体展现在访问者面前了。
  • line5-line26: 其中内容就是每篇post在首页的显示内容。一般来说分成三个部分:标题,包括文章題目,作者名字,写作时间;正文内容;留言提示,比如有多少留言,文章所属分类。至于具体位置随个人爱好,如果你不懂php也没什么关系,随便找一个模版然后依样画葫芦copy & paste就可以了。
  • line28-line31: 导航栏。就是下一页/上一页这个东西。
  • line35-line37: 这个是当一篇文章都没有的时候显示的报措信息。

  基本上index.php主要内容就是一个循环语句,不断显示每篇文章直到你后台设定的那个显示文章数为止。
  这篇内容比较少,明天会把有关sidebar.php和footer.php的part5跟上。到part5其实整个模版就接近完成了,其他的几个文件基本上都是从这几个文件中演变出去,不会太费事。
  海豚的这个简单教程很快会结束,然后把Kamus要求修改的Blix模版完成,四月底想做一个新的模版。新模版可能会比较中规中矩,不过将会融入WidgetsWordPress Theme Toolkit或许还有AJAX效果的留言以方便后期修改。

6 Responses to “海豚的WordPress Theme教程 part4”

Leave a Reply to kDolphin

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).