【发布时间】:2015-10-08 14:21:20
【问题描述】:
我在我的网站上收到此错误:
警告:array_map() [function.array-map]:参数 #2 应该是第 86 行 /home/content/77/12366977/html/wp-content/themes/rocco/functions.php 中的一个数组
警告:implode() [function.implode]:第 86 行 /home/content/77/12366977/html/wp-content/themes/rocco/functions.php 中传递的参数无效
我认为发生错误的行是这一行: * 摘录 * ------------------------------------------------- -------------------------- */ 函数 mfn_excerpt($post, $length = 55, $tags_to_keep = '', $extra = ' [...]') {
if(is_int($post)) {
$post = get_post($post);
} elseif(!is_object($post)) {
return false;
}
if(has_excerpt($post->ID)) {
$the_excerpt = $post->post_excerpt;
return apply_filters('the_content', $the_excerpt);
} else {
$the_excerpt = $post->post_content;
}
$the_excerpt = strip_shortcodes(strip_tags($the_excerpt, $tags_to_keep));
$the_excerpt = preg_split('/\b/', $the_excerpt, $length * 2+1);
$excerpt_waste = array_pop($the_excerpt);
$the_excerpt = implode($the_excerpt);
if( $excerpt_waste ) $the_excerpt .= $extra;
return apply_filters('the_content', $the_excerpt);
如果添加代码是解决方案,我应该做什么以及应该在哪里添加代码? 非常感谢您的帮助!
【问题讨论】:
标签: php wordpress function themes implode