Skip to content

Instantly share code, notes, and snippets.

@fatihtoprak
Created October 24, 2012 20:11
Show Gist options
  • Save fatihtoprak/3948537 to your computer and use it in GitHub Desktop.
Save fatihtoprak/3948537 to your computer and use it in GitHub Desktop.
wp#3 özel query dropdown ile
<?php
# http://wordpress.stackexchange.com/questions/59486/mysql-custom-wp-query
?>
<?php
$values = get_tags();
if(sizeof($values) > 0) : ?>
<select name="tags">
<option value="">default</option>
<?php
# I've used value=id instead of name / slug, which is always better, but just change the index if desired
foreach ($values as $value) : ?>
<option value="<?php echo($value->term_id); ?>"><?php echo($value->name); ?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment