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
- Remove Actions/Filters added via Anonymous Functions
- Remove Container Element From wp_nav_menu() Markup
- Is there a hook or function I can use to display all theme files being used on a current page?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- How can I get $id variable in widget’s form function?
- Filter the query ONLY for the search results page
- opening links in new tab using – add_filter( ‘the_content’, ‘make_clickable’);
- Implementing DNS Prefetching with WordPress
- How to activate “Description” metabox for menu item programmatically?
- Get password when user registers and save it sha1 into database
- Set default options for inserting media
- How to hook into the quick edit action?
- Override a class function to include a custom template
- How to programmatically set a menu to be the Primary Menu?
- WooCommerce add_action hook results in 500 error
- Make menu structure match page heirarchy on page parent change
- Post Pagination Showing Same Posts Every Page
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- WordPress after content Hook & external template part
- How to add #navbar to all page links?
- str_replace function in theme
- Pass info from functions.php to plugin
- Inserting a functions output after the content
- Handling Body class based on Template
- Menu item added in wp_nav_menu_items filter is never highlighted
- Don’t delete a page if it holds users
- Is possible add icon in title posts only in specific tag?
- WordPress Gravatar filter is removing my custom attributes
- Adding an external HTML link to a post thumbnail
- Issue understanding and using WordPress filters and actions
- Custom taxonomy widget in admin area
- Registration Hooks don’t appear to be working
- How do you Permanently Delete Sidebars
- Removing specific menu items?
- Redirect to another page using contact form 7? [closed]
- Custom Sidebar only on single post
- Call to undefined function is_home() or any conditional tags
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- How to append custom text to the output of ‘categories widget’?
- Hook for altering the content of all wp mails
- Must filter functions receive all arguments passed to them?
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Get URLs for AJAX Filter Checkboxes WordPress
- Filter works on last selection but no others
- How to automatically add counted number to navigation 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
- Redirect specific author posts to another url
- True email confirmation for registration (keeping unvalidated users from user table)
- Best way to add image to recent posts widget?
- Language Switch Function
- Modify sub_menu function to show pages below a specifically set page
- Init hook for header send
- How to add a class name to the ancestor of a post?
- How do I add functionality to images?
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Assign new post author IF another user in custom field on post transition
- How to Add Extra Text In WordPress Title Before Post Publish
- function to show youtube videos within excerpt – if condition and apply_filters