• Resolved Cookowl

    (@cookowl)


    Hi!
    I’m using WPML and I need to show different banners on my page. Function should look something like this:

    function language_selector_logo(){
        $languages = icl_get_languages('skip_missing=0&orderby=code');
        if(!empty($languages)){
            foreach($languages as $l){
    			if ($l['active'] &&  ($l['language_code'] == 'en')) echo '<div class="logo-wrap"><img src="/image01.jpg" /></div>';
    			if ($l['active'] &&  ($l['language_code'] == 'ru')) echo '<div class="logo-wrap"><img src="/image02.jpg" /></div>';
            }
        }
    }

    Could you help me implement this? Can I raplace mh_logo() with this function or that’s not enough?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Cookowl,

    without testing your code I would say that it should work. Have you tried already to replace the mh_logo() function?

    You can replace:

    <?php mh_logo(); ?>

    in header.php with this:

    <?php language_selector_logo(); ?>

    and see if it works like you want to have it. You might need to modify the CSS a bit if the logo is not placed properly but at least it should be displayed with this.

    Also, the mh_logo() function is pluggable so you can just create a new function with the same name in the functions.php of your child theme and it will automatically be used instead of the original mh_logo() function, doing it that way, you will just have to create the new function and there is no need to modify header.php. ??

    If your function does not work properly, please open a thread in the WPML support forum. The developers of the plugin will be able to support you with this.

    I wish you a nice day.

    Regards
    Michael

    Thread Starter Cookowl

    (@cookowl)

    Michael,
    what I needed to know is basically what is the output of mh_logo(). But my function worked. Thank you.

    Hi Cookowl,

    the output of mh_logo() is just the default logo or the logo which was uploaded in the WordPress header settings. If no logo is set, it will output site name and site description.

    You can find the code for mh_logo() in functions.php.

    Regards
    Michael

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom logo-wrap for WPML’ is closed to new replies.