创建Thesis的自定义页面

作者:feir 发表于:2009-03-06,#1条评论。

最近把博客换到了Chris Pearson开发的Thesis主题,感觉非常强大,折腾Thesis也成了这几天的主要事情。网上有部分关于thesis的修改教程,但是更多的资料还是在收费会员才能查阅的论坛中,真是比较遗憾。

昨天因为要建立一个搜索结果的结果页面,要使用custom page templates,在网上找了N久都没发现如何在Thesis里建立自定义页面。只好反反复复的折腾,最后找到了办法,分享如下。

首先在创建页面(Page)的时候选择template为custom template。记下page的ID。

然后在custom_functions.php里面根据自己需要添加以下代码:
[php]
//自定义搜索页面
function my_page() {
if (is_page(’592′)) /*你的页面ID*/
{ ?>
//下面基本套用thesis现有的html代码

页面标题

你的页面内容,可以使用php或者html代码

//添加sidebar

}
}
//去掉thesis默认的自定义模板,加载自己的模板
remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'my_page');
[/php]

要建立其他自定义页面只要在custom_functions.php里面添加新的function就可以了。另外关于hooks的介绍,可以参照Charles的浅析WordPress中的Hook机制,以及Thesis Hooks使用的教程

{ 1 comment }

1 nengwu.wu 03-06 at 7:50 pm

小飞哥,
你的链接我已经作好了。
sunlick’s blog
http://www.wunengwu.cn

Comments on this entry are closed.

Previous post:

Next post: