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'm working on a responsive webdesign where my navigation should swap into a select-menu when resizing the window in smaller sizes.

Is it somehow possible to add another param to functions like wp_list_categories() or wp_list_pages() so that it outputs <option>item</option> instead of <li>item</li>?

So what I wanna do is use wp_list_pages() and wp_list_categories() to ouput its default stuff in order to have a normal menu. However I also want to ouput the same pages and categories in a second <select><option>… navigation that is hidden by default but shown when a media-query is triggerd. Any idea how to dynamically produce this second menu?

Thank you in advance!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

you can easily do this the same way as wp_list_pages(), using wp_dropdown_pages(). the args needed to retrieve the pages are the same. for the categories, use wp_dropdown_categories()

share|improve this answer
    
In addition I wrote a plugin that outputs a wordpress nav menu from the back end as a dropdown: wordpress.org/extend/plugins/dropdown-menus –  sanchothefat May 2 '12 at 14:39

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.