Support » Themes and Templates » wp_list_pages quick question
7 years, 7 months ago
Using wp_list_pages, I’d like to add ↓ (a down arrow) next to top-level pages that have children pages. (The idea is then to have a drop-down hover menu displaying the child pages.) What’s the best way to do this?
A quick question, but I don’t know of a quick solution. I’ve coded navigation bars and the like that are context sensitive to the current location. wp_list_pages() isn’t aware very aware of taxonomy.
Basically, use http://codex.wordpress.org/Function_Reference/get_pages and then test each result with http://codex.wordpress.org/Function_Reference/get_page_children. If the test returns true, draw an arrow, otherwise draw normal.
I don’t have any PHP that does this exactly, all my functions are mixed up with other functionality otherwise I’d copy them for you.