I've been researching here and on other dev/WP sites to find the best solution for adding what is effectively a custom element to the navigation menu, and it seems like there are many approaches. Ultimately, I'd like a add a "Newsletter" item to the primary navigation menu, that would either include a form field directly in the menu to collect email addresses, or some kind of drop-down, into which the address can be entered.
One option seems to be using the Walker Class with wp_nav_menu
; or using add_last_nav_item
as suggested here. The only issue with the latter option is that I'd likely prefer to add this custom element in a position on the nav bar before the last item. Finally, I've also contemplated creating a custom widget and using a plugin to add the widget to the navigation bar.
Does anyone have any recommendations for adding this custom element to the nav menu? Any suggestions are most appreciated.
header.php
template?