0

我正在使用 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)是要重复的长代码。与“,',\”和$。

我已经尝试过调用该代码的函数、键和包含,但它们都不能正常工作。我什至不确定它是否可以像我尝试的那样“简单”地完成。我根本不是专家。

非常感谢。

4

1 回答 1

0

我只需要输入“return $html;” 在 {} 内(我在其中写了“这里……”,就是这样!

现在我只需要找到一种更好的方法来设置可能的组合(我必须再添加 2 个选项,这让我有 16 种可能性......)

于 2013-08-08T10:45:07.397 回答