我想向wordpress提交一个主题。组织。当我把define(\'WP_DEBUG\', true);
在我的wp-config.php
. 我的主题出现了一些错误。但我不知道如何纠正主题。
第一季度:Warning: Missing argument 2 for cutstr() in ....htdocs\\wordpress\\wp-content\\themes\\warm-home\\functions.php on line 156
. 以下是我的功能。
function cutstr($string, $length) {
$string =strip_tags($string);
preg_match_all("/[x01-x7f]|[xc2-xdf][x80-xbf]|xe0[xa0-xbf][x80-xbf]|
[xe1-xef][x80-xbf][x80-xbf]|xf0[x90-xbf][x80-xbf][x80-xbf]|[xf1-xf7][x80-xbf][x80-xbf][x80-xbf]/", $string, $info);
for($i=0; $i<count($info[0]); $i++) {
$wordscut= \'\';
$wordscut .= $info[0][$i];
$j=\'\';
$j = ord($info[0][$i]) > 127 ? $j + 2 : $j + 1;
if ($j > $length - 3) {
return $wordscut." ...";
}
}
return join(\'\', $info[0]);
}
add_action(\'after_setup_theme\',\'cutstr\');
调用的功能行是:<p><?php echo cutstr($post->post_content,150) ?></p>
.没有遗漏参数2。为什么显示上述错误?如何更正?