Avanceret søgning

[insert_php]

global $wp_query;

$qvars = false;
if (isset($wp_query->query_vars[‘linkcats’]))
$qvars = $wp_query->query_vars[‘linkcats’];

$llh = new LinkLibraryHelper();
$cats = $llh->getCategories();

echo ‘

‘;

foreach ($cats as $groupname => $group) {

if ($groupname == “cat”) {

ksort($group);

echo ‘

‘;
echo ‘‘;
echo ‘

‘;
foreach ($group as $subgroupname => $subgroup) {
echo ‘
‘;
foreach ($subgroup as $name) {
$default = false;
$label = $name;
if ($llh->endsWith($name, ” (#)”)) {
$label = substr($name, 0, strlen($name) – 4);
$default = true;
}
$fullname = $groupname . ‘.’ . $subgroupname . ‘.’ . $name;
$checked = “”;
if (($qvars and in_array($fullname, $qvars)) or ($default and !$qvars)) {
$checked = ” checked = ‘checked'”;
}
echo ‘
‘;
}
}
echo ‘

‘;
}
else {

sort($group);

$lbl = $llh->get_group_label($groupname);

echo ‘

‘;
echo ‘‘;
echo ‘

‘;
foreach ($group as $count => $subgroup) {
$default = false;
$label = $subgroup;
if ($llh->endsWith($subgroup, ” (#)”)) {
$label = substr($subgroup, 0, strlen($subgroup) – 4);
$default = true;
}
$checked = “”;
$fullname = $groupname . ‘.’ . $subgroup;
if (($qvars and in_array($fullname, $qvars)) or ($default and !$qvars)) {
$checked = ” checked=’checked'”;
}
echo ‘
‘;
}
echo ‘

‘;
}
}

echo ‘

‘;

echo ‘

‘;

if ($qvars) {

$good_links = $llh->get_relevant_links($qvars);
if (!empty($good_links)) {
echo ‘

‘;
}
}

[/insert_php]