我在maxmenu配置面板小部件中集成了php小部件,使我的菜单动态化 但是当我执行wp_debug模式时,它会在每个帖子之前显示一条错误消息,即:
undefined variable eval()'d code on line 9
在php小部件的php文件中
我在php小部件中的代码是:
<div class="container">
<div class="row">
<?php query_posts('cat=11&posts_per_page=5');?>
<?php if(have_posts()):
while (have_posts()) : the_post();
$img = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'menu-thumb');
$item = '<div class="col-lg-2">
<div class="mega_single">
<a href="'.get_permalink().'">
<img src="'.$img[0].'" class="img-responsive" alt="">
<article>'.get_the_title().'</article>
</a>
</div><!--mega single-->
</div>';
echo $item;
endwhile; endif;?>
</div>
</div>