Walkers don’t have associated stylesheets. That’s not how they work. You need to load them separately by enqueuing the stylesheet in the wp_enqueue_scripts
hook, as you’ve done in load_css()
. The walker class gets used by setting the walker
argument of wp_nav_menu()
to an instance of the class when you’re rendering the menu in a template. Since the class isn’t instantiated or used until the menu is rendered it can’t enqueue stylesheets in the header.
If the markup of your menu matches what you expect from the walker class, and you can see your stylesheet being loaded by a <link rel="stylesheet" />
tag in the header, then you’ve done everything correctly. If you’re still not getting the result you expect then the problem is likely with your CSS. It’s likely that the selector is incorrect, or its specificity is not sufficient to override existing styles.
Related Posts:
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- What is the best way to provide plugin users with a way to customized the styles
- Get Current Menu Location inside Nav_Walker
- Remove unwanted elements for a wp_nav_menu
- Customize existing menu item
- Are there any official or unofficial guidelines for the styling of a widget?
- How To Protect Plugin Display From Being Affected By Theme’s CSS
- How to show only the last two categories in a menu?
- Create and style menu
- Change the_title() of a page dynamically
- Add Dividers or Separators Between Nav Menu Items
- Overide get_template_part( ‘partials/post’, ‘sidebar’ ); with a plugin
- Using a Theme inside a Plugin directory
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Plugin development without Theme adjustments?
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- Programmatically Selecting Theme Based on URL
- How to properly use a hook to create template for custom product type in a plugin such as Woocommerce? [closed]
- What is better way to use Bootstrap inside admin panel?
- How do I approach removing menu items on the fly based on settings in my plugin?
- wp_enqueue_style built in styles
- What is the difference between current_page_parent and current_page_ancestor?
- Add Submenu Link in add_submenu_page That Opens in a New Window
- Header Button Chance Polylang Elementor
- Hook into theme-switching later than `setup_theme`
- Dequeue theme stylesheets but keep widget styling on custom page template
- Where is definied the theme location for the main menu in a WordPress template?
- How to check if a stylesheet is already loaded?
- How to add pages to custom menus on the fly [duplicate]
- How can I add a CSS rule to edit.php?
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- WordPress security issue to output data from user input from theme option form
- Remove Internal Style Sheet if no Value Provided?
- Which themes do you use to test compatibilities with your plugin [closed]
- How do I include background images in my stylesheets in a plugin?
- Editing WordPress Nav Menu Walker
- Is there no admin ui guide for 4.x?
- Correct check for any admin page with editor
- Plugin menu addition in multisite
- How to find out if page_for_posts is showing (in order to style menu item)
- Theme Install using a Custom Repository
- Change submenu markup
- How to remove default style of header in wordpress metabox
- Custom code for WordPress dynamic menu
- Auto-Populate Image After Media Upload
- Custom Walker for wp_list_categories
- How do I access the menus produced by Dashboard > Appearance > Menus
- How to create a backend for a custom theme?
- How can I avoid conflicts between plugin and theme?
- Redirect to another page using contact form 7? [closed]
- Plugin Development/ Stop CSS clashes.
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- Add child pages to submenu automatically
- My stylesheets are not enqueuing
- Proper way to include stylesheet for panels
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- How to add Plugin functionality in WordPress Frontend Menus
- Default Nav Highlight
- Get images / media attached to a page by page ID
- Extend Menu Walker Output
- How to insert HTML/CSS/JS into my iframe plugin?
- How to hide page links from theme menu
- Some doubts about WordPress handle the horizontal main menu visualization
- How do I add a menu item to a Pods admin menu?
- WordPress Plugin Authoring question about jquery and css
- Add user managable titles to custom menus?
- How to add some basic inline CSS using existing plugin or theme?
- Displaying custom content from a plugin within the active theme
- How to create archive page to add in menu
- Getting Post ID at “stylesheet” and “template” hooks
- Why nav_menu_css_class doesn’t work with apply_filters?
- WordPress admin panel not working
- Structuring Nav Menu and Background Custom page (Help)
- Stuck while adding bootstrap navwalker class
- Always hide a page from the menu
- Redirect theme directory to plugin theme directory
- Making my main menu a hamburger menu on all platforms
- how to add custom css at top above all css file for specific url
- Post Pagination does not working on WP-Query
- Publish, Save Draft and Preview buttons do not work after being moved with jQuery
- Unable to link CSS file
- How to get an array out of a nav menu if it’s a plugin?
- How can I add the Post ID to Class Name in Jquery?
- Managing Custom Designed Content
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Best practice to include custom user styles in widgets
- Custom CSS File wont work on second Page
- Invalid Menu Items
- Find Any Theme’s page.php File
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- How to create A – Z List with pictures?
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Hide menu items from not logged in users
- Theme / Divi change visitor css and site logo and all site urls based on REQUEST_URI non logged in wp user
- adding an options menu that allows saving multiple sets of said options