0

WordPress技巧(9): 未着装Theme Starkers

Starkers: the completely naked theme for WordPress

假如你是新手,又不想从头写那些反复的theme基本文件,请看这里。一款未穿上衣服的theme衣架。适合初学者全面了解,wordpress theme 的文件框架。

这里还有几个测试xml,可以import一下,看看效果。

Dummy Content:

WP XML Test Data Import

When developing themes one of the biggest frustrations can be the lack on content on a new installation of WordPress. Self Conclusion has put together an XML file with several posts and pages of dummy content with tags, categories, comments, links, lists, and everything you will need to test a theme. You can easily download this file and import it into WordPress to save the time of adding your own dummy content.

Sandbox Dummy Content

For Sandbox design competitions, a set of dummy content was released. It achieves the same purpose as the content from Self Conclusion that was just mentioned.

WordPress Test Post Pack

Think Design Blog also has a pack of dummy content that can be downloaded and imported into WordPres

0

WordPress技巧(6): 替换”read more”

做以下的定义,修改第三行的代码,放到functions.php文件中,all will be ok!

<?php

$custom_more = "Continue reading this post";
add_filter( 'the_content_more_link', 'my_more_link', 10, 2 );

function my_more_link( $more_link, $more_link_text ) {
	return str_replace( $more_link_text, $custom_more, $more_link );
}
?>
0

WordPress技巧(3): 消失的页面模板

作为WP的进阶问题,我们知道在制作theme的时候,我们可以通过制作不同的page来自定义发布的页面,例如打算制作一个不同的个人简介页面,或者是个人作品的展示页面。这个时候page模板定义就可以发挥他的作用了。
以个人简介为例,我们在theme目录下创建一个about.php,在文件的头部写入:

<?php
/*
Template Name:About
*/
?>

作为模板的索引,这样我们就能在创建page页面的时候,在右侧模板选项里面找到这个about模板。

这里我们要注意的是,由于我们升级过WP后,会造成模板在右侧模板选择处无法找到。WordPress Page Template Field Missing
解决方法:只需要再一次激活此模板即可。

0

WordPress技巧(1): 主题中快速调用JQuery

jQuery是一个非常棒的js框架,假如你想在你的WordPress中使用,你知道如何更快捷的调用么?

首先要说的是WordPress已经包含了JQuery,所以你不无需再去下载一个新的JQuery拷贝。只需要使用wp_enqueue_script() 函数,就可以自动在主题的头部调用。打开header.php文件,将以下的代码插入<head></head> 标签中:

<?php wp_enqueue_script("jquery"); ?>