所以我有標題排序子頁面的列表中。我正在使用自定義字段wordpress插件。切換元件與複選框某些屬性
這是
<p>City: <?php the_field('city',$page->ID); ?></p>
我想讓複選框(某處頁)因此,如果您取消選中該複選框,將元素在li元素的含量的線路之一,可以說,城市=紐約,將消失。
到目前爲止的代碼:
<input type="checkbox" class="newyork" name="beograd" checked>Chicago<br>
<input type="checkbox" class="cicago" name="Chicago" checked>Pancevo<br>
<?php
$mypages = get_pages(array('child_of' => $post->ID, 'meta_value' => '', 'sort_column' => 'city', 'sort_order' => 'asc'));
foreach($mypages as $page) {
$content = $page->post_content;
if (! $content)
$content = apply_filters('the_content', $content);
?>
<li class="clan">
<a class="noselect"><?php the_field('naziv',$page->ID); ?></a>
<div class="clan_content">
<div class="podaci">
<p>City: <?php the_field('city',$page->ID); ?></p>
</div>
</li>
<?php
}
?>
成功
添加<li class="clan" title="<?php the_field('city',$page->ID); ?>">
然後
$(function() {
$('#newyork').change(function() {
$(".clan_content").stop().slideUp();
$("[title=NewYork]").toggle(this.checked);
}).change();
});
節目呈現的HTML,到目前爲止,你已經嘗試了爵士。 – guradio
@guradio完成。所以,我想隱藏帶class =「族」時元素包含城市=「紐約」例如每鋰元素。 – trgt