userkind
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: output the post id of wp_nav_menu itemsHere’s the Walker_Nav_Menu code that I have working:
It gets the main menu and outputs each menu item’s post-id in a comma delimited list.
// get menu item's content id class pages_from_nav extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $item_output .= $item->object_id; $item_output .= ','; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } }Forum: Plugins
In reply to: output the post id of wp_nav_menu itemsThat totally did it! Thanks a million.
BTW, do you know of a reference of where I could see a list of variables like object_id to know that it exists?
Forum: Plugins
In reply to: output the post id of wp_nav_menu itemsAfter some more research getting me nowhere on the issue, I’m wondering If the only way to accomplish this is via a custom sql query.
I’ve been avoiding that because there must be a better way, after all $item->url figures out how to build the link based on the destination content, but perhaps there’s not.
Is there a way to hook into the $url variable and get the content id that way?
Forum: Plugins
In reply to: output the post id of wp_nav_menu itemsbump, any takers?
Viewing 4 replies - 1 through 4 (of 4 total)