[How to] Add Categories Dropdown to the End of Dropdown Menu Widget
I recently added hooks to the dropdown menu widget and using those hooks you can enlarge your navigations easily. Here i will show you how to add a categories dropdown to the end of pages menu, as seen on my site.
We can achieve this simply using dropdown_list_after
hook. Here is the sample code:
function add_categories(){ /* Open top level item and sub-list */ echo "nt<li><a href="#cat">Categories</a><ul class="children">"; /* List categories using wp function*/ wp_list_categories('title_li=&'); /* Close sub-list & top level */ echo "nt</ul></li>"; /* You can add your own links too! */ echo "<li><a href="https://wpassist.me/">Shailan.com</a></li>"; } add_action('dropdown_list_after', 'add_categories');
You can easily append anything to the end of list using this simple function.
Enjoy!