Adding a Site Login/Logout Link to an existing Menu in WordPress
You can add on to the end of an existing WordPress menu a site login/logout link. The WordPress menu must be registered and have a theme location, this will not work with custom menus. This needs to be added to your theme functions.php file add_filter( ‘wp_nav_menu_items’, ‘themeprefix_login_logout_link’, 10, 2 ); function themeprefix_login_logout_link( $items, $args ) { if(…
Read MoreAdd WooCommerce Cart Icon to Menu with Cart Item Count
Here is a way to add WooCommerce cart icon to a menu with the cart item count, it links to the cart page and displays the number of items that have been added to the cart. The code uses three functions which need to be added to functions.php and some CSS in style.css. (If you just…
Read MoreAdd Search Toggle Icon at End of Menu in WordPress
In WordPress, you can add a search toggle field at the end of a menu using the filter wp_nav_menu_items or a similar menu filter by which you can append menu items at the end of the targetted menu, add a slideToggle with jQuery for the show/hide effect and a bit of CSS. Targetting the Menu…
Read MoreAdd WooCommerce MyAccount Page Login/Logout to Menu
This code adds a login/logout link to your WordPress primary menu to log the user into the WooCommerce My Account page and then also log out to the same or different page. It differs from the referred article as that adds the WordPress default login/logout page. The menus need to be registered via register_nav_menu and positioned with theme_location,…
Read More