I am writing a website based off of wordpress and am having some difficulties. I know I can use
<?php wp_list_pages('title_li=&depth=1'); ?>
However, how can I assign a mouseover attribute to the <li> that is created? Also, if there are children pages, they need to be in a nested <ul> and show as a dropdown when the parent is hovered on.
Review the “Markup and Styling” Section of the Codex page for
wp_list_pages. It describes how apage_itemclass is applied to each<li>. Use that class to assign your mouseover attribute on the client side. If you are not using jQuery, I recommend it.You can use
get_pages()to create your child page dropdown menu’s. The same Codex page I linked to above describes using this function to get all your page_id’s. You can then iterate over them and useget_pages()again specifying that you want to retrieve only child pages of the given page id. Using css to hide the child page dropdown lists, you can use javascript again to show the dropdowns when the pages are moused-over in the parent page menu.