在Wordpress中,我有一个与医生的CPT,其中包含两个分类:医疗专科和医疗护理协议。
我正在为一个小诊所建立一个网站,我需要创建一个预约表单,在那里人们可以选择医生,医疗专业和各自可用的医疗保健协议。
如何动态填充多个选择,其中用户通过专业->医生->协议进行过滤
发布于 2016-11-23 06:19:15
可以使用jQuery/Ajax How to change options of with jQuery?动态填充Select
对于高级分类查询,请检查此https://code.tutsplus.com/tutorials/wp_query-arguments-taxonomies--cms-23090
用于生成专业下拉列表的:
$terms = get_terms( array(
'taxonomy' => 'specialty',
'hide_empty' => false,
) );
这将输出数组,您可以使用该数组生成select。
有关函数及其参数的更多信息:https://developer.wordpress.org/reference/functions/get_terms/
用于为具有所选专业的医生生成下拉列表的
$args = array(
'post_type' => 'doctor',
'tax_query' => array(
array(
'taxonomy' => 'specialty',
'field' => 'slug',
'terms' => 'eye',
),
),
);
$query = new WP_Query( $args );
这将输出数组,您可以使用该数组生成select。
有关函数及其参数的更多信息:https://codex.wordpress.org/Class_Reference/WP_Query
第三个下拉列表的:
不清楚
https://stackoverflow.com/questions/40751841
复制相似问题