(2014-08-28, 07:40:02)mvlcek Wrote:(2014-08-28, 05:37:34)GuyB Wrote: I've tried this and am struggling! this is what I have done..
I've created a custom field called MenuImage and set up a default image.
I've created a component called navimage with this in it:
<li class="<?php echo $item->classes; ?>">
<a href="<?php echo htmlspecialchars($item->link); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
<?php if ($item->isOpen) { ?>
<ul><?php $item->menuimage(); ?></ul>
<?php } ?>
</li>
I've altered my template.php to this:
<ul><?php get_i18n_navigation(return_page_slug(),0,100,navimage); ?></ul>
hanks
Guy
Remove the parentheses:
(and you need to add the image tag <img ...>, as above code only returns the link, if it's an image field)Code:<?php $item->menuimage; ?>
Add quotes:
Code:<?php get_i18n_navigation(return_page_slug(),0,100,'navimage'); ?>
Hello Mwlcek,
Can you explain that please about the image tag?
Thanks
Guy
(2014-08-28, 10:14:26)Timbow Wrote: For simple menu items with different background images. This line of css will give a default background image to menu items:Thanks very much Timbow,
then for specific images for specific pages:Code:nav a {background-image:url(images/menuimg01.png);}
Which says (in english)Code:nav a[href*="about"] {background-image:url(images/menuimg02.png);}
Quote:for anchor elements which are children of nav, if the href contains the text "about" then the background image is menuimg02.png
That seems understandable.
Regards
Guy