我做到了!我找到了一个函数,使option value=\'slug\'。
功能:
class SH_Walker_TaxonomyDropdown extends Walker_CategoryDropdown{
function start_el(&$output, $category, $depth, $args) {
$pad = str_repeat(\' \', $depth * 3);
$cat_name = apply_filters(\'list_cats\', $category->name, $category);
if( !isset($args[\'value\']) ){
$args[\'value\'] = ( $category->taxonomy != \'category\' ? \'slug\' : \'id\' );
}
$value = ($args[\'value\']==\'slug\' ? $category->slug : $category->term_id );
$output .= "\\t<option class=\\"level-$depth\\" value=\\"".$value."\\"";
if ( $value === (string) $args[\'selected\'] ){
$output .= \' selected="selected"\';
}
$output .= \'>\';
$output .= $pad.$cat_name;
if ( $args[\'show_count\'] )
$output .= \' (\'. $category->count .\')\';
$output .= "</option>\\n";
}
}
和我的所有代码:
<?php /** * Displays the Pagination in Custom loop * */?>
<?php get_header(); ?>
<?php global $wp_query;
$aranan= $_GET[\'s\'];
$kategorim = intval($_GET[\'cat\']);
$kateg1= $_GET[\'kategorisec\'];
if (intval($kateg1)<0) { $kateg = ""; } else { $kateg = $kateg1; }
$myterm = get_term( $kategorim, \'fgaleri\' );
global $myslug;
$myslug = $myterm->slug; ?>
<div id="content">
<?php $rakam= 0;
//The query
$wp_query->query( array( \'post_type\' =>\'fotograf\', \'s\' => $aranan, \'paged\' => $paged, \'taxonomy\' => \'fgaleri\', \'fgaleri\' => $kateg ) );
//The loop
?><div id="FGaleri_2"><div id="FGaleri_Ic"><div id="FGaleriBaslik">Fotoğraf Galerisi <form action="<?php echo get_bloginfo(\'wpurl\'); ?>" id="searchformfoto" method="get" name="searchform">
<?php $args = array( \'walker\'=> new SH_Walker_TaxonomyDropdown(), \'class\' => \'postform\', \'id\' => \'kategorisec\', \'name\' => \'kategorisec\', \'value\'=>\'slug\', \'taxonomy\' => \'fgaleri\', \'show_option_none\' => \'Kategori Seç ve Ara\', \'hierarchical\' => 1 ); wp_dropdown_categories($args); ?>
<div id="aramabolumufoto">
<input name="s" id="sfoto" type="text" value=""/>
<input type="hidden" name="post_type" value="fotograf" />
<input id="searchsubmitfoto" type="submit" value="Ara"/>
</div></form></div>
<div class="FGaleri_Ic_2">
<?php while ($wp_query->have_posts()): $wp_query->the_post(); $rakam++; ?>
<div class="FGaleriItem2" style="<?php if ($rakam % 5 == 0 ) { ?>margin-right: 2px;<?php } ?>">
<?php
$termargs=array(\'orderby\' => \'count\', \'order\' => \'desc\');
$terms = wp_get_post_terms( $post->ID , \'fgaleri\', $termargs );
$t = count($terms);
if ($t>0) { ?>
<div class="fkategori">
<?php $c = 0;
foreach($terms as $term) {
$c++;
if ($c==$t)
{ echo \'<a class="foto_kategori" href="\'. home_url() . \'/?kategorisec=\' . $term->slug . \'&post_type=fotograf" title="\' . $term->name . \'" \' . \'>\' . $term->name.\'</a> \'; }} ?>
</div><?php } ?>
<div class="ResimUst">
<?php if (has_post_thumbnail()) { ?>
<a href="<?php the_permalink() ?>">
<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );$url2 = get_bloginfo(\'template_directory\') . "/timthumb.php?src=" . $url . "&w=100&h=100&zc=1"; ?>
<img src="<?php if(get_option(\'of_timthumb\')=="true") { echo $url2; } else { echo $url; } ?>" alt="" title="" width="100" height="100" /></a>
<?php } ?>
</div><div class="ResimAlt"><a href="<?php the_permalink() ?>">
<?php the_title(); ?>
</a></div></div>
<?php if (($rakam % 5 == 0 ) && ($rakam > 4)) { ?><div class="clearboth"></div><?php } ?>
<?php endwhile; ?></div></div></div><div class="clearboth"></div>
<?php if(function_exists(\'wp_pagenavi\') ) {
wp_pagenavi();
//function call for plugin pagination( wp pagenavi plugin)
} else { ?>
<div id="navigasyon"><span class="previous-entries">
<?php next_posts_link(\'« Daha Eski Fotoğraflar\'); ?></span>
<span class="next-entries"><?php previous_posts_link(\'Daha Yeni Fotoğraflar »\'); ?></span>
</div><?php } //endif ?><?php ?></div><?php get_sidebar(); ?></div><?php get_footer(); ?>