Dropdown categories archives

Hi i findscript for widgets categories and archives.
For dropdown menu categorie ( i have many gategories )
I putscript in sidebar.php in theme travelify but no effet :confused:

code for cotegories :

<form action=”<?php bloginfo(‘url’); ?>/” method=”get”>
$select = wp_dropdown_categories(’show_option_none=Select category&show_count=1&orderby=name&echo=0′);
$select = preg_replace(”#<select([^>]*)>#”, “<select$1 onchange=’return this.form.submit()’>”, $select);
echo $select;
<noscript><input type=”submit” value=”View” /></noscript>

and code for Archives is :

<select name=”archive-dropdown” onChange=’document.location.href=this.options[this.selectedIndex].value;’>
<option value=””><?php echo attribute_escape(__(’Select Month’)); ?></option>
<?php wp_get_archives(’type=monthly&format=option&show_post_count=1′); ?> </select>

Thank you for your help

Why you are trying to code some custom solution while there is an option inside WordPress that does exactly that?

Just add category or archive widget and check “Display as dropdown” and you are ready to go. No coding is required for that and theme is already optimized to take care of these dropdowns.

I trying because, i don’t have dropdown choice in widget categories and archives:/
I have last version of WP

Link for image of widget


Here is how default category and archive widgets looks like:

default wordpress

Most likely you are using some plugin for that, therefore, I can’t help you with that. Make sure that you really need that plugin that you are using for widgets.

Really sorry i don’t remember put a plug in widget on WP.
I change the plug in and is good.
Thanks Aigars