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