wp_dropdown_categories not work on wordpress 2.7 (6 posts)

  1. lowell123456
    Posted 7 years ago #

    Hello Guys
    Few months ago i have buy a premium theme for my web site, but now after update to Wp 2.7 it not working good.

    In this theme an user can insert info in a form (in a page of wp), but in the dropdown menĂ¹ now not show the categories name but only this 0" value="8 (8 is the number of the categories). It's a big problem for me. Please can help me on this problem?

    The cose is this:

    					$cats = wp_dropdown_categories('orderby=name&order=ASC&hide_empty=0&echo=0');
    					$cats = str_replace("\n", "", $cats);
    					$cats = str_replace("\t", "", $cats);
    					$cats = str_replace("<select name='cat' id='cat' class='postform' ><option value=\"", "", $cats);
    					$cats = str_replace("\">", "-", $cats);
    					$cats = str_replace("</option><option value=\"", "_", $cats);
    					$cats = str_replace("</option></select>", "", $cats);
    					echo "<select name=\"postcats\" id=\"postcats\">\n";
    							$cats = explode("_", $cats);
    							foreach ($cats as $catsss) {
    								$catsss = explode("-", $catsss);
    								$cat_id = $catsss[0];
    								$cat_name = $catsss[1];
    								echo "<option value=\"$cat_id\">";
    									echo $cat_name;
    								echo "</option>\n";
    					echo "</select>";
  2. lowell123456
    Posted 7 years ago #

    The problem maybe is setting of my wordpress?? the code maybe is correct!

  3. lowell123456
    Posted 7 years ago #

    help please!!!

  4. lowell123456
    Posted 7 years ago #

    can download the them here for try and see the same error:


  5. lowell123456
    Posted 7 years ago #

    Not work with the 2.7 version of wp, only with the 2.6

  6. l4duk
    Posted 7 years ago #

    I have no idea where you got that code from, use this

    <?php wp_dropdown_categories('show_option_none=Select category'); ?>
    <script type="text/javascript"><!--
        var dropdown = document.getElementById("cat");
        function onCatChange() {
    		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
    			location.href = "<?php echo get_option('home');
        dropdown.onchange = onCatChange;

Topic Closed

This topic has been closed to new replies.

About this Topic