Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION I18N navigation with images or background image and text
#9
(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:
Code:
<?php $item->menuimage; ?>
(and you need to add the image tag <img ...>, as above code only returns the link, if it's an image field)

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:
Code:
nav a {background-image:url(images/menuimg01.png);}
then for specific images for specific pages:
Code:
nav a[href*="about"] {background-image:url(images/menuimg02.png);}
Which says (in english)
Quote:for anchor elements which are children of nav, if the href contains the text "about" then the background image is menuimg02.png
Thanks very much Timbow,
That seems understandable.
Regards
Guy
Reply


Messages In This Thread
RE: I18N navigation with images or background image and text - by GuyB - 2014-08-28, 17:45:02



Users browsing this thread: 1 Guest(s)