If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.
March 20, 2012 at 10:27 pm #10563
I’ve got a pic all ready to go, I just don’t know how to get the photo up in the header next to it’s sub menu link! also how to make the pic an active link.March 21, 2012 at 6:36 pm #68512March 21, 2012 at 7:23 pm #68513
You can add the link html code in header.php – I’d add it directly before following code line:
If you’re familiar with php you can also “hook” into the menu function . A very basic code would be:
function add_login_logout_link($items, $args)
if(is_user_logged_in() && $args->theme_location == 'avia1')
$newitems = '<li><a title="my link" href="http://myurl.com"><img src="my-image.jpg" alt="" /></a></li>';
$newitems .= $items;
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);March 21, 2012 at 7:34 pm #68514
I got the pic and link to work but how can i position it where I want in the header? right now it’s crowding the social network icons. I want it on the way left.March 21, 2012 at 7:47 pm #68515
Since you already have the link there, I would suggest customizing it directly by adding the following to your custom.css or Quick CSS and then removing the image link from your header.php.
If you ever redo the menu, you’ll need to change that menu id(the 1118) to the correct number and when you make the site live, you’ll need to change the image URL to the new location if it changes, but that is pretty simple to do.
}March 21, 2012 at 8:04 pm #68516
Hey, so when I try your code, it is no longer a hyperlink after removing is from header.php
also your padding moves the CART text, not my cart image which I wish to be on the RIGHT of the cart text about 1 space
also, for future reference, how did you determine the image was item# 1118?March 21, 2012 at 9:51 pm #68517
adding a text indent should work better:
the #menu-item-(id) can be checked when viewing the source code of the menuMarch 22, 2012 at 1:34 am #68518
you are a god send! I’m trying to put the cart image on the RIGHT of the cart text though. Can’t seem to get it.March 22, 2012 at 9:18 am #68519
try this instead
background-position: 25px 12px;
ChrisMarch 22, 2012 at 1:53 pm #68520
The topic ‘add shopping cart pic next to cart link in header/sub menu?’ is closed to new replies.