I'm looking around and see some hints at what I'm wanting to do may be possible, but it's just not clicking for me.
I have a custom post type rt_doctors. I'm trying to make it so there will be a dynamic list of the doctors in my main menu.
I'd like to have in the Nav Menu a menu item doctors that links to the index/archive page of my doctors Custom Post Type, and hanging from this Menu Item, a list of Submenu Items each linking to a single post of the doctors themselves.
It looks like i may need to use a custom walker, but i don't seem to understand it.
here is the code i added just as a test: (I created a page called Products2 because my cpt is making products as the archive page. I've tried with just Products as well (I have that page created from before the cpt was made also)
class Walker_rt_Submenu extends Walker_Nav_Menu {
function end_el(&$output, $item, $depth=0, $args=array()) {
if( 'Products2' == $item->title ){
$output .= '<ul><li>Dynamic Subnav</li></ul>';
}
$output .= "</li>\n";
}
}
wp_nav_menu(
array(
'theme_location' => 'primary',
'walker' => new Walker_rt_Submenu
)
);
but i get this error:
Call to a member function get_page_permastruct() on null in /home/randomnoises/public_html/wp-includes/link-template.php on line 355
I'm just using twenty sixteen as the theme for testing.