shmideo Posted October 21, 2013 Share Posted October 21, 2013 Hi all Our website has 9 languages and I have a ribbon banner graphic placed on top of the header. I would like to know if it is possible to have 9 images (one for each) for the languages but to show the image corresponding to the country chosen, for example /en or /fr etc. Using wordpress 3.6 The image looks for a page /satisfaction-guarantee/ and will go to the relevant country on click, eg, /en/satisfaction-guarantee/ etc. Would love to know how to do the same kind of thing for the actual ribbon banner also. Thanks shmideo The code that shows the banner is below: <div id="inner_wraper"> <div class="menu_wrap"> <div id="header"> <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'my_nav','sort_column'=>'menu_order' ) ); ?> </div> </div> <div class="clear"></div> <div class="slider_logo_wrap"> <div id="top_banner"> <a href="<?php bloginfo('url')?>/satisfaction-guarantee/"><img src="<?php echo get_option('banner_image'); ?>" alt=" "/></a> </div> Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted October 21, 2013 Share Posted October 21, 2013 (edited) I experimented a few ways with exploding the current url but it can get messy dealing with pages and subdomains. Hopefully this way can work for you and modify to all your languages and where you store the banner images at. <?php $pageURL = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; if(preg_match("~/fr/~",$pageURL)){ $page_language = "fr"; }elseif(preg_match("~/it/~",$pageURL)){ $page_language = "it"; }else{ $page_language ="en"; } $banner_location = "http://".$_SERVER['SERVER_NAME']."/images/".$page_language.".png"; ?> <div id="inner_wraper"> <div class="menu_wrap"> <div id="header"> <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'my_nav','sort_column'=>'menu_order' ) ); ?> </div> </div> <div class="clear"></div> <div class="slider_logo_wrap"> <div id="top_banner"> <a href="<?php bloginfo('url')?>/<?php echo $page_language."/";?>satisfaction-guarantee/"><img src="<?php echo $banner_location; ?>" alt=" "/></a> </div> Edited October 21, 2013 by QuickOldCar Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted October 21, 2013 Share Posted October 21, 2013 After reading your post a few times i don't think code applies to what you wanted. What I did what link a banner to the current language page were on. I don't see your ribbons code anywhere. Quote Link to comment Share on other sites More sharing options...
shmideo Posted October 21, 2013 Author Share Posted October 21, 2013 Yes I cannot find where it actually gets the image name from. I know where the image is on the server but that's about all. Have checked Wordpress and nowhere I can see where the image is (corner_banner.png). Have done a content search for the image name on the server and no sign of it. Thanks shmideo Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted October 21, 2013 Share Posted October 21, 2013 If posted a link to your site can possibly find it or what's producing the image. Quote Link to comment Share on other sites More sharing options...
shmideo Posted October 21, 2013 Author Share Posted October 21, 2013 Here's the link: http://nordiccall.dk/ Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted October 21, 2013 Share Posted October 21, 2013 The sitepress-multilingual-cms plugin is what is determining which flags and links to use, would need to edit that, or ask the developer of this plugin to incorporate some features. Quote Link to comment Share on other sites More sharing options...
shmideo Posted October 21, 2013 Author Share Posted October 21, 2013 Hey QuickOldCar it worked! Just need a modification to show the default country image url,ie url without the / (nordiccall.dk) Thanks shmideo Quote Link to comment Share on other sites More sharing options...
shmideo Posted October 21, 2013 Author Share Posted October 21, 2013 I've figured it out how to also show the default country. Thanks for your solution it works great! Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted October 21, 2013 Share Posted October 21, 2013 Glad to hear that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.