Use $items="Blah".$items instead of $items .= 'Blah'
add_filter( 'wp_nav_menu_items', 'add_logo_to_menu_item', 10, 2 );
function add_logo_to_menu_item ( $items, $args ) {
if ($args->menu == 'main-menu') {
$items="<li><a href="#"><img src="PATH_TO_IMAGE"></a></li>" . $items;
}
return $items;
}
Related Posts:
- Run a filter when a walker runs
- Add data attribute to each li in menu
- Unique icons next to each WordPress menu item
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- How to add different menu items on different menus?
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- Apply class to every paragraph that holds image?
- Remove “Insert from URL” link in Media upload – WP 3.5
- static variable loop not working in WordPress
- Displaying Logged-In User Name in WordPress Menu
- Set media upload attachment link to none and hide it in WP v3.5
- Check if a menu is empty?
- How can I hook into and edit the text of a wp_nav_menu tag?
- How to overwrite youtube embed?
- Check if page parent has certain template
- Change comments form title on a page by page basis
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- Remove class that has been added by parent theme
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How do I know what variables are passed in a filter/action and what their meaning is?
- Why do filters/actions require an argument count?
- WordPress menu deletes when trying to add a hook
- Logout and redirect using the WP Menu
- How to use return in my custom function instead of echo
- Have CSS Class Added with `is_page()` WP function
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Handling Body class based on Template
- Get_avatar filter?
- Add a class to the anchor tag on HTML5 gallery
- Menu — How to add “current-menu-grand-ancestor” css class
- Input type search in Menu
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- add_action shortcut?
- How can I remove a function that has been added to wordpress with add_filter?
- How to control WordPress image metadata (using Imagick)?
- How do I add custom bulk actions to multiple custom post types?
- Automatically adding new post categories to menu
- Removing “wpautop” (auto tags) only on certain pages?
- Print last modified date only on posts
- WordPress Gravatar filter is removing my custom attributes
- Child page menu in sidebar
- Title Case WordPress Menu Items
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- How to change menu order item
- Redirect to another page using contact form 7? [closed]
- Alter required message using comment form api
- How to make modifications only to certain elements of an HTML string on the server-side?
- Override a function defined in wp-includes/comment-template.php
- Register a menu – Error Header
- Filtering a function’ output for a new continued function
- Deleting Certain terms from appearing on the front end as links
- Upload multiple files in randomly generated folder using wp_upload_bits
- Create page template via functions.php?
- Add meta tags to a custom header
- Add value to new attribute inside WordPress menu items
- How to have different site identity logos on each page on Astra Theme [closed]
- Custom query vars filters problem with pagination
- How can I use custom menus with a Bootstrap WordPress theme?
- Must filter functions receive all arguments passed to them?
- Remove submenu item from list
- Dynamic Menu drops pages?
- Menu not styling. New menus functionality giving me a headache
- User filter posts by year
- how to changes mobile menu toggle breakpoint in WordPress
- How to display already created menus via php?
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- How to remove get_header From all single pages in wordpress with functions.php without plugin?
- Apply function.php filter only if url not has /amp/
- Change lost password url to a mailto URL in WordPress
- How to put 2 php codes in functions.php without site crashing
- Menu not updating for logged in users after redirect
- How to bind each “the_content” elements to a custom variables
- Reload page with a different shortcode when a user selects from a dropdown
- WordPress Ajax filter: Create two loops for different output styles?
- Add element after navigation element title don’t works like I expect
- How to disable sub menu items from being created?
- Add parent menu item in sub-menu in custom nav_walker
- Custom Bulk Actions handler not firing
- How to generate customized filtered output for the gallery
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- How to remove title tag with this filter
- str_replace not preserving whitespace
- Pulling a variable into the wp_nav_menu function
- Beyond widget side menu editing, with the php page, custom template
- Woocommerce Price Text
- Limit Taxonomy Parents
- WordPress adding in site URL to header links
- Display a list of users with avatar filterable with alphabets
- AJAX: WordPress filters inside $html do not work as intended
- Assign new post author IF another user in custom field on post transition
- Add attribute to featured image with filter (wp_get_attachment_image_attributes)
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to pass value to add_filter wpcf7_form_tag from another function?
- Add text below WooCommerce short description if metabox value is true
- Is there a hook that I can use when a fatal error occurs?
- Unable to logout correctly after wp-login file was modified
- Filtering with Attributes – how to display all non-queried products below query