【发布时间】:2013-12-16 19:50:47
【问题描述】:
我正在为 WordPress 档案创建分类过滤器。 I have the checkboxes working so when selected they redirect the page to the correct URL based on the taxonomy slug.我的问题是页面重新加载后复选框状态重置为未选中。
这是我的代码:
<?php
$workoutmoves = get_terms('Exercise-Types', array('hide_empty' => 0));
?>
<?php if ($workoutmoves): ?>
<h5>Show Me</h5>
<ul class="no-bullet">
<?php foreach($workoutmoves AS $workoutmove): ?>
<li>
<input class="check_box" type="checkbox" value="<?php echo $workoutmove->slug; ?>"><?php echo $workoutmove->name; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
我想在输入字段中添加一个 php if 语句并回显 'checked="checked"' 但我不知道如何获取正确的数据来确定是否应该设置它。
任何见解都会有很大帮助。谢谢。
【问题讨论】: