Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have the selected option saved correctly, but when load the page, wp_dropdown_categories still load the list by its order. I prefer to load the selected item on top. How to do this?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

if the currently selected item has some type of identifier on it (maybe class="current") you may be able to use some jquery to grab it's value, hide it, then move it to the top.

<div class="topdiv">
this is top div
</div>

<ul>
<li>1</li>
<li class="current">2</li>
</ul>

(function() { var top = $('.current').html(); $('.current').hide(); $('.topdiv').text(top); })();

this worked in testing

share|improve this answer
    
Thanks for the code! I've figured out that wp cat dropdown is not convinient. I will code the select box myself. But I will apply your code on other places that need move. –  Jenny Aug 29 '12 at 0:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.