Combo Menu categories in WordPress 2.5.1

To create a menu / combo (tag select ) without a submit button and can move to the category currently displayed, you can use the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14

"" > Seleziona una categoria < / option > < option value = ""> Select Category </ option >
<Php
? ( single_cat_title ( '' , false ) ) : "" ) ; $ Foo = ((is_category ())? (Single_cat_title ('', false)): "");
) ; $option = '' ; $ Get_categories categories = ('orderby = name & hierarchical = 0'), $ options ='';
foreach ($ categories as $ cat) {
$cat-> cat_name == $foo)?"selected":"" ).' $ Option. = '<option'. (($ Foo == $cat-> cat_name)? "Selected": ""). ' value = "/ category / '. $ cat-> category_nicename .'">';
$ Options .= $ cat-> cat_name;
$ Options .= '('. $ Cat-> category_count .')';
'; $ Options .= '</ option > ';
}
echo $ option;
?>
</ select >

, permette di eliminare un eventuale bottone di submit. The event onchange , in the tag select , eliminates any submit button. The function WordPress is_category() , however, determines whether we are displaying a "store" categories, in order to obtain the title / name of the displayed category.

There are no comments for this post

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL 


Stop SOPA