Javascript 过滤新闻';在Wordpress下的侧边栏上选中类别复选框发布
在这里,我有上面的截图,它列出了我的Wordpress环境中的所有类别。我列出了 1) 父类别Javascript 过滤新闻';在Wordpress下的侧边栏上选中类别复选框发布,javascript,php,jquery,wordpress,checkbox,Javascript,Php,Jquery,Wordpress,Checkbox,在这里,我有上面的截图,它列出了我的Wordpress环境中的所有类别。我列出了 1) 父类别 动物 儿童动物种类 承载 长臂猿 猩猩 犀牛 老虎 2) 父类别 儿童运动类别 亚洲犀牛项目 澳大利亚红毛猩猩项目 释放熊 银长臂猿项目 在我的php文件中,我有以下代码组成我的复选框的显示结构 <form action="<?php the_permalink(); ?>" id="filterForm" method="post"> <?php
- 动物
- 承载
- 长臂猿
- 猩猩
- 犀牛
- 老虎
- 亚洲犀牛项目
- 澳大利亚红毛猩猩项目
- 释放熊
- 银长臂猿项目
<form action="<?php the_permalink(); ?>" id="filterForm" method="post">
<?php
$parent_categories = get_categories($parent_args);
foreach($parent_categories as $parent_category){
//create main headings for other categories other than Uncategorized.
if($parent_category->name!="Uncategorized"){
$category_label = "Filter By ";
echo '<h3 style="font-size: 20px; color: rgb(255, 255, 255);text-shadow: 2px 3px 0px rgb(0, 0, 0);">'.$category_label.''.$parent_category->name.'</h3>';
//fetch the parent category's id
$firstchild_args['parent'] = $parent_category->term_id;
$firstchild_categories = get_categories($firstchild_args);
//fetch all the first level children categories
foreach($firstchild_categories as $firstchild_category){
$output = "";
$output = $output."<label class=\"checkbox\">";
$output = $output." <input type=\"checkbox\" value=".$firstchild_category->cat_ID." onclick=\"processForm()\"><span style='font-size: 17px; color: rgb(255, 255, 255);text-shadow: 2px 3px 0px rgb(0, 0, 0);'>".$firstchild_category->name;
$output = $output."</label>";
echo $output;
}
}
}
?>
<input type="hidden" name="submitted" id="submitted" value="true">
</form>