I have a custom post type, Doctors, that I need to create a dropdown nav for. I just want it to populate a select list with all the posts of that CPT and navigate to that post on selection.
I’m doing a couple other dropdowns with wp_dropdown_categories, but I guess there’s no built in function for listing a post type?
You’ll need to use
get_posts
and roll your own drop down.Something like this (somewhere in
functions.php
):Then in your template…
This function behaves more like
wp_dropdown_categories
function
use
I’ve added a javascript line to ‘Jump’ directly to the selection.
Before:
After: