Support » Fixing WordPress » In search of a working category list dropdown

  • Following advice in another thread, I added this to my index.php file:

    <li id="categories"><?php _e('Categories:'); ?>

      <form name="catform"; onchange="window.location = 'index.php?cat='+(document.forms.catform.cat[document.forms.catform.cat.selectedIndex].value);">

      <?php dropdown_cats(); ?>

      </select>

      </form>

    Unfortunately, it didn’t work for me. Clicking on one of the category names didn’t do anything. I also tried this:

    <li id="categories">Categories:
    <form name="categories">
    <select name="menu" onChange="MM_jumpMenu('parent',this,0)">
    <option selected value="">Select Category</option>
    <?php dropdowncats_option('name','desc',0,1,1); ?>
    </select>
    </form>


    Although asthetically more pleasing, this second form didn’t do anything either. I would like to just have a user click on the category and be taken to the corresponding page, without having to click on a submit button.
    Ideally, but not of paramount importance at this point, I would like the subcategories displayed under their parents, with the number of posts in each category following it.
    Can anyone help me out with this, or head me in the right direction to solving this problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Did you add the appropriate javascript in the head of your document?
    Kevin

    Mark (podz)

    (@podz)

    Support Maven

    Check out a site such as http://www.dynamicdrive.com for drop down scripts that do what you need.
    Although you do have that tag there, that just tells the browser that what follows is something that is not html, and somewhere in the < head > section should be the complete instructions for the commands that that script uses. Get that, and all should be fine.

    <script language=”JavaScript” type=”text/JavaScript”>
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+”.location='”+selObj.options[selObj.selectedIndex].value+”‘”);
    if (restore) selObj.selectedIndex=0;
    }
    </script>

    Silver

    (@silver)

    I didn’t experience a runtime error when I went to the link you specified in the above post (your site). However, I did notice that you used
    onChange=”MM_jumpMenu(‘parent’,this,0)”
    within the jump menu code for your Category Drop Down menu but when I viewed the source for the page the Javascript code that Beel provided to you (above) was missing.

    pezastic

    (@pezastic)

    Now, there’s a plugin that gives you both a hierarchal list -and- post count for your categories in a dropdown. It can be found here.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘In search of a working category list dropdown’ is closed to new replies.