分类: 默认

如何自动在WordPress每篇日志最后添加指定内容

许多博客自动在日志最后显示一些内容,比如邀请读者订阅RSS。这些内容一般是通过硬编码添加的。为什么不用functions.php来做?并且更换模板不会对此产生影响。
要实现这一功能,你需要在functions.php添加如下代码,这样当你更换模板时也不用重新插入代码。

function insertFootNote($content) {
if(!is_feed() && !is_home()) {
$content.= “”;[……]

阅读全文»

mb_substr修正函数

用于不支持mb_substr的地方

// Patch in multibyte support
if (!function_exists(‘mb_substr’)) {
function mb_substr($str, $start, $len = ”, $encoding=”UTF-8″) {
$limit = strlen($str);
for ($s = 0; $start > 0;–$start) {// found the real start[……]

阅读全文»

鄂ICP备13000209号-1

鄂公网安备 42050602000277号