我正在使用 Cimy User Extra 字段过滤结果(我无法进行查询等)。因此,我创建了一个下拉表单,并使用选定的字段/值来过滤要显示的用户。
这是用于显示用户“列表”的 Wordpress 用户插件的功能
function get_user_listing($curauth) {
global $post;
$concat = wpu_concat_single();
$homeuni=get_cimyFieldValue($curauth->ID,'homeuni');
$selectedhomeuni = $_GET['homeunis']; // Key that gets one dropdown value
$selectedhostuni = $_GET['hostunis']; // Key that gets the other dropdown value
if($selectedhomeuni == "all" && $selectedhostuni == "all") {
// Here goes the bunch of repeated code
}
elseif($selectedhomeuni != "all" && $selectedhostuni == "all") {
// Here goes the bunch of repeated code again
}
elseif($selectedhomeuni == "all" && $selectedhostuni != "all") {
// Here goes the bunch of repeated code again
}
elseif($selectedhomeuni != "all" && $selectedhostuni != "all") {
// Here goes the bunch of repeated code again
}
return $html;
}
这里(Pastebin)是要重复的长代码。与“,',\”和$。
我已经尝试过调用该代码的函数、键和包含,但它们都不能正常工作。我什至不确定它是否可以像我尝试的那样“简单”地完成。我根本不是专家。
非常感谢。