我目前正在尝试使用get\\u选项调用自定义小部件的字段,并循环通过get\\u option()调用创建的数组。问题是,它在最后输出一个空白的,导致比我启用的多出一个。以下是我目前掌握的代码:
$the_team = get_option(\'widget_jcMeetTeam\');
$the_id = 1; //used for an ID increment for the jquery this will be used for
print_r ($the_team);
if (count($the_team) > 1) {
foreach ($the_team as $team_member) {
extract($team_member);
echo \'<div class="panel" id="\'.$the_id.\'">
<img src="\'.get_bloginfo(\'template_url\').\'/images/about_lgplace.png">
<h2>\'.$team_member[\'jc_name\'].\'</h2>;
<p>Occupation: \'.$team_member[\'jc_occupation\'].\'</p>
<p>Favorite Wine: \'.$team_member[\'jc_favwine\'].\'</p>
<p>About: \'.$team_member[\'jc_about\'].\'</p>
</div> \';
++$the_id; //increment for next panel ID
}
}
我目前正试图找出如何在显示最后一个空白循环之前停止循环,从而给出活动小部件实例的准确列表。