You can modify the arguments passed to wp_nav_menu
with a filter called wp_nav_menu_args
. You can use this filter to add a walker class, which will modify the behaviour of wp_nav_menu
.
This approach is kind of hackish, because the walker class will still ‘walk’ through all the menu items, but you can control them, so decide not to output any item. Here’s a nice tutorial on the walker class.
Inside your walker class you can include your custom content. Note that you’ll need to add html
, as PHP
code will not be evaluated anymore.
Related Posts:
- How to influence the information displayed on widget inside wp-admin
- Passing values from a widget to a function within a plugin
- Issues with title-tag and document_title_parts
- Define custom Page Template without its own .php file
- Using add_filter() in Widgets
- Remove Page Title from Static Frontpage
- Programmatically Add Font-Awesome Icons to Category Widget
- Increment price for Woocommerce Minicart [closed]
- Gravity Forms field entries into wp_query loop [closed]
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- Which action hook to use for function?
- Modify a function without editing template
- How to add nav menu items to a specific position within a menu
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Override the WordPress core function wp_referer_field
- How to edit the Tags within the image file URLs?
- Can’t properly set the_title add_filter to show short_URL
- How to add_filter html template to middle of content
- (Woocommerce) Order by price when entering specific category
- How do I hook into the container of wp_nav_menu?
- Filter nav menu items HTML tags and wrap inner text with span
- Possible to hook into Media Library preview File column and use a custom image?
- How to add custom li item to wordpress menu
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Add Adsense code between job listings – wp job manager plugin
- search form leads to 404
- How to conditionally add a widget via a hook in functions.php
- Changing the text of Upload/Insert on Posts and Pages Screen
- Conditional custom menu?
- Warning at top of website & top menu gone
- How to display an image before title text in menu items
- Save_post – Warning: Cannot modify header information
- custom error message for empty username and password using authenticate filter not working
- How Do I Unhook This Parent Theme Function?
- How to add widget in main menu
- wp_nav_walker that interacts with widgets to setup mega menu
- Function Reference for custom link in Admin Menu Management Page
- Force resize for all video content
- Get post_author email for Zapier Integration
- Plugin function in child theme
- How to automatically add counted number to navigation menu items?
- Use action, filter, or hook to append HTML to WordPress plugin function
- Child theme remove parent filter in functions
- Extend WordPress Audio Widget to accept HLS (.m3u8) URLs
- How can I automatically delete comments that contain a URL?
- Appending „read more” to the excerpt conditionally
- Calling hooks in functions
- How to add class dynamically from templates
- Combine multiple menus using the filter wp_nav_menu_items
- Prevent function from triggering on current page
- Assign IDs to headings in ACF using functions.php
- Menu and category highlighting for a single post
- WordPress Toggle Menu has stopped working
- function replace_text for entire page
- add product thumbnail to checkout page only and include variation name
- Redirect specific author posts to another url
- my wordpress doesn’t save items to customized widget area
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to add custom column into custom post, when field is select
- ACF Filter return value
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Graphic before title – Specific Category
- How can I stop the hook from breaking the login/logout function?
- Which method is more correct for removing WooCommerce Extensions menu item?
- Copying a widget class to functions.php results on a blank page
- True email confirmation for registration (keeping unvalidated users from user table)
- $content is empty while using DOMDocument
- Hide disclaimer from summary excerpts
- Adding A New Widget to WordPress Disables the Existing Widgets
- WordPress hooks to call a function inside a construct
- WordPress undefined function error on using add_action() in functions.php
- Only seems to be displaying one child when there are supposed to be multiple
- Best way to add image to recent posts widget?
- How to echo the translated custom field?
- How to make an If Else on Excerpt Filter
- Add Class to Custom Menu Widget ul
- Language Switch Function
- Why might wptexturize have become re-enabled?
- Shortcode to eliminate and replace with
- previous_post_link inside of a function?
- Search and Replace Script Loader in Head Only Works in Footer
- Regex works in regexr, but not if I filter content [closed]
- Insert menu into theme location depending on user logged in/out status
- Retrieve a custom form field modified by a filter
- functions.php filters not applied in AJAX call
- Adding custom field in menu options [duplicate]
- Function the_content
- Problem in outputting shortcode
- Modify sub_menu function to show pages below a specifically set page
- save_post hook – headers already sent?
- Expanding a function to call a plugin or show a link
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- Settings in functions.php used by a plugin
- WordPress Javascript Widget jQuery Dependency Issue
- Adding a filter with custom function to the menu / navigation
- Register a widget area when a theme option has been saved?
- How to Add A Rel Filter to All Links?
- Print all inline styles to head