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!
1 Answer
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()