Answer the question
In order to leave comments, you need to log in
Error Notice: Undefined variable: output in?
Hello. There is a site on CMS Wordpress.
There is one ancient plugin (function) there, which, when moving to the server, began to give an error:
Notice: Undefined variable: output in "...." on line 670
The whole function looks like this:
add_filter('widget_text', 'do_shortcode');
function last_review() {
$args = array(
'parent'=>0,
'post_type' => 'dealer',
'number' => '5',
'orderby' => 'date',
'order' => 'DESC'
);
$comments = get_comments($args);
$output .= '<ul class="rev">';
foreach($comments as $comment) :
$title=get_the_title($comment->comment_post_ID);
$nazv = get_post_meta($comment->comment_post_ID, 'nazv', 1);
if ($nazv) {$title=$nazv;} else {}
$output .= '<li>';
$output .= '<a href="' . get_permalink( $comment->comment_post_ID ) . '">' . $title . '</a><br />';
$output .=( $comment->comment_content);
$output .= '</li>';
endforeach;
$output .= '</ul>';
return $output;
}
add_shortcode('rev', 'last_review');
$output .= '<ul class="rev">';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question