此错误不断循环,我的error_log不断增加。
PHP警告:第491行的header.php中为foreach()提供的参数无效
<?php
// (get_option_tree('theme_skin', '', false)!=""&&get_option_tree('theme_skin', '', false)!="Default") ||
if(true){
$theme_background_color="#3f92a8";
// if(get_option_tree('theme_background_color', '', false)!="")
// $theme_background_color=get_option_tree('theme_background_color', '', false);
if(!isset($_GET['presets'])){
if($_GET['presets']=='preset1')
$theme_background_color='#3f92a8';
if($_GET['presets']=='preset2')
$theme_background_color='#b71010';
if($_GET['presets']=='preset3')
$theme_background_color='#E16204';
if($_GET['presets']=='preset4')
$theme_background_color='#1b5e88';
if($_GET['presets']=='preset5')
$theme_background_color='#13D7FD';
if($_GET['presets']=='preset6')
$theme_background_color='#685518';
if($_GET['presets']=='preset7')
$theme_background_color='#5B2F2A';
if($_GET['presets']=='preset8')
$theme_background_color='#6A6664';
if($_GET['presets']=='preset9')
$theme_background_color='#C53D96';
if($_GET['presets']=='preset10')
$theme_background_color='#62CDDF';
if($_GET['presets']=='preset11')
$theme_background_color='#AD00B4';
if($_GET['presets']=='preset12')
$theme_background_color='#6000A0';
if($_GET['presets']=='preset13')
$theme_background_color='#990';
if($_GET['presets']=='preset14')
$theme_background_color='#353535';
if($_GET['presets']=='preset15')
$theme_background_color='#706852';
if($_GET['presets']=='preset16')
$theme_background_color='#BCDD39';
if($_GET['presets']=='preset17')
$theme_background_color='#FC0';
if($_GET['presets']=='preset18')
$theme_background_color='#600';
if($_GET['presets']=='preset19')
$theme_background_color='#FF7400';
if($_GET['presets']=='preset20')
$theme_background_color='#b0c288';
}
?>
<div class="grid_10 abr-omega" id="slogan">
<div class="socialMedia">
<div class="socialIco"><span></span></div>
<div style="text-align: right;" class="smile">
<?php
$slides = get_option_tree('sm_icons', $option_tree, false, true, -1);
foreach ($slides as $slide) {
echo '<a href="' . $slide['link'] . '"><img src="' . $slide['image'] . '" alt="' . $slide['title'] . '" /></a>
';
}
?>
<div class="clear"></div>
</div>
</div>
任何人都知道如何解决这个问题?这是来自WordPress主题。
谢谢。
答案 0 :(得分:0)
试试这段代码。 $slides
应该是一个非空或字符串的数组。
$slides = get_option_tree('sm_icons', $option_tree, false, true, -1);
if(count($slides)>0){
foreach ($slides as $slide) {
echo '<a href="' . $slide['link'] . '"><img src="' . $slide['image'] . '" alt="' . $slide['title'] . '" /></a>
';
}
}