【发布时间】:2013-12-23 15:53:05
【问题描述】:
我的 wordpress 主题在调试模式下出现以下错误。可能很容易解决,但我不知道该怎么做。
未定义变量:输出 .... 第 34 行($output 变量)
$categories = get_the_category();
if($categories) {
foreach($categories as $category) {
$output .= '<a href="'.get_category_link( $category->term_id ).'" class="btn-standard-blog" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>';
}
}
echo $output;
【问题讨论】:
-
如果
$categories是false会发生什么?
标签: php