Created
September 5, 2011 22:04
-
-
Save curtismchale/1196027 to your computer and use it in GitHub Desktop.
gives the user more options to filter the site by (like meta values)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="get" id="searchform" action="<?php echo home_url(); ?>/"> | |
<label class="hidden" for="s"><?php _e('', 'comienzo'); ?></label> | |
<input type="search" class="text" value="search site" name="s" id="s" /> | |
<select name="sport"> | |
<option value="" />Choose sport</option> | |
<?php | |
$metakey = 'sfn_tan_choose_sport'; | |
$sports = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) ); | |
if ($sports) { | |
foreach ($sports as $sport) { | |
echo "<option value=\"" . $sport . "\">" . $sport . "</option>"; | |
} | |
} | |
?> | |
</select> | |
<select name="fbposition"> | |
<option value="" />Choose football position</option> | |
<?php | |
$metakey = 'sfn_tan_football_position'; | |
$items = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) ); | |
if ($items) { | |
foreach ($items as $item) { | |
echo "<option value=\"" . $item . "\">" . $item . "</option>"; | |
} | |
} | |
?> | |
</select> | |
<select name="state"> | |
<option value="" />Choose state</option> | |
<?php | |
$metakey = 'state'; | |
$items = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->usermeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) ); | |
if ($items) { | |
foreach ($items as $item) { | |
echo "<option value=\"" . $item . "\">" . $item . "</option>"; | |
} | |
} | |
?> | |
</select> | |
<select name="grad"> | |
<option value="" />Choose graduation year</option> | |
<?php | |
$metakey = 'sfn_tan_hs_graduation_year'; | |
$items = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) ); | |
if ($items) { | |
foreach ($items as $item) { | |
echo "<option value=\"" . $item . "\">" . $item . "</option>"; | |
} | |
} | |
?> | |
</select> | |
<input type="hidden" name="post_type" value="athlete_profile" /> | |
<input type="submit" id="searchsubmit" value="Search" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment